Skip to content

Commit 8d4217c

Browse files
committed
0.4.9.2
1 parent c6c6e21 commit 8d4217c

8 files changed

Lines changed: 13 additions & 15 deletions

File tree

datatorch/agent/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@ async def stop() -> None:
150150
logger.info("Closing all other tasks.")
151151
await _exit_tasks()
152152

153-
loop = asyncio.get_event_loop()
153+
loop = asyncio.get_running_loop()
154154
loop.stop()

datatorch/agent/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ def _init_logger(self):
4040

4141
def _init_threads(self):
4242
self.system_stats = AgentSystemStats(self)
43-
loop = asyncio.get_event_loop()
43+
loop = asyncio.get_running_loop()
4444
task = loop.create_task(self.system_stats.start())
4545
tasks.append(task)
4646

4747
async def process_loop(self):
4848
"""Waits for jobs from server."""
4949
logger.info("Waiting for jobs.")
5050
async for job_request in self.api.agent_jobs():
51-
loop = asyncio.get_event_loop()
51+
loop = asyncio.get_running_loop()
5252
job = job_request.get("job")
5353
task = loop.create_task(self._run_job(job))
5454
tasks.append(task)

datatorch/agent/monitoring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def _task_monitoring(self):
9090
while True:
9191
self.sample += 1
9292
stats = self.stats()
93-
loop = asyncio.get_event_loop()
93+
loop = asyncio.get_running_loop()
9494
if self.sample != 1:
9595
loop.create_task(self.agent.api.metrics(stats))
9696
await asyncio.sleep(self.sample_rate)

datatorch/cli/action/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,4 @@ async def run_action():
6969
json.dumps(output, indent=4, sort_keys=True) if output else "No output."
7070
)
7171

72-
loop = asyncio.get_event_loop()
73-
loop.run_until_complete(run_action())
72+
asyncio.run(run_action())

datatorch/cli/agent/start.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import click
22
import asyncio
3-
import functools
43
import signal
54

65
from asyncio.events import AbstractEventLoop
76
from datatorch import agent
87

98

109
def add_signal_handlers(loop: AbstractEventLoop):
11-
exit_func = functools.partial(asyncio.ensure_future, agent.stop())
10+
exit_func = lambda: loop.create_task(agent.stop())
1211
try:
1312
loop.add_signal_handler(signal.SIGINT, exit_func)
1413
loop.add_signal_handler(signal.SIGTERM, exit_func)
@@ -18,7 +17,8 @@ def add_signal_handlers(loop: AbstractEventLoop):
1817

1918
@click.command(help="Run an agent")
2019
def start():
21-
loop = asyncio.get_event_loop()
22-
asyncio.ensure_future(agent.start())
20+
loop = asyncio.new_event_loop()
21+
asyncio.set_event_loop(loop)
22+
loop.create_task(agent.start())
2323
add_signal_handlers(loop)
2424
loop.run_forever()

datatorch/cli/pipeline/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ async def run_jobs(pipeline: Pipeline):
2727

2828
await asyncio.wait(tasks)
2929

30-
loop = asyncio.get_event_loop()
31-
loop.run_until_complete(run_jobs(Pipeline.from_yaml(path)))
30+
asyncio.run(run_jobs(Pipeline.from_yaml(path)))

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Click==8.0.0
1+
Click==8.4.0
22
gql
33
websockets
44
websocket-client

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
long_description = fp.read()
99

1010
requirements = [
11-
"Click==8.0.0",
11+
"Click==8.4.0",
1212
"gql==3.4.0",
1313
"websockets==10.4",
1414
"websocket-client",
@@ -33,7 +33,7 @@
3333

3434
setup(
3535
name="datatorch",
36-
version="0.4.9.1",
36+
version="0.4.9.2",
3737
description="A CLI and library for interacting with DataTorch.",
3838
author="DataTorch",
3939
author_email="support@datatorch.io",

0 commit comments

Comments
 (0)