File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 ())
Original file line number Diff line number Diff line change 11import click
22import asyncio
3- import functools
43import signal
54
65from asyncio .events import AbstractEventLoop
76from datatorch import agent
87
98
109def 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" )
2019def 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 ()
Original file line number Diff line number Diff 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 )))
Original file line number Diff line number Diff line change 1- Click == 8.0 .0
1+ Click == 8.4 .0
22gql
33websockets
44websocket-client
Original file line number Diff line number Diff line change 88 long_description = fp .read ()
99
1010requirements = [
11- "Click==8.0 .0" ,
11+ "Click==8.4 .0" ,
1212 "gql==3.4.0" ,
1313 "websockets==10.4" ,
1414 "websocket-client" ,
3333
3434setup (
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" ,
You can’t perform that action at this time.
0 commit comments