File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
services/director-v2/src/simcore_service_director_v2/modules/comp_scheduler Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1212"""
1313
1414import asyncio
15+ import concurrent
16+ import concurrent .futures
1517import datetime
1618import logging
1719from abc import ABC , abstractmethod
7880
7981
8082def _auto_schedule_callback (
83+ loop : asyncio .AbstractEventLoop ,
8184 db_engine : Engine ,
8285 rabbit_mq_client : RabbitMQClient ,
8386 * ,
@@ -95,11 +98,13 @@ async def _async_cb():
9598 iteration = iteration ,
9699 )
97100
98- future = asyncio .run_coroutine_threadsafe (
99- _async_cb (), asyncio .get_running_loop ()
100- )
101- with log_catch (_logger , reraise = False ):
102- future .result (timeout = 10 )
101+ future = asyncio .run_coroutine_threadsafe (_async_cb (), loop )
102+
103+ def handle_future_result (fut : concurrent .futures .Future ) -> None :
104+ with log_catch (_logger , reraise = False ):
105+ fut .result (timeout = 10 )
106+
107+ future .add_done_callback (handle_future_result )
103108
104109 return _cb
105110
You can’t perform that action at this time.
0 commit comments