helgestein / helao-pub

hierachical automation of the natural sciences
MIT License
20 stars 5 forks source link

Set of coroutines/Futures is empty.' #12

Closed Yohko closed 3 years ago

Yohko commented 3 years ago

When only launching async-orch with world config:

(helao) E:\Matthias\GitHub\helao-dev>python helao.py world 'pids_world.pck' does not exist, writing empty global dict. Configuration for 'world' is valid. Launching server group. Launching action group. Launching orchestrators group. Launching orchestrator at 127.0.0.1:8010 using orchestrators/async_orch.py ←[32mINFO←[0m: Started server process [←[36m22688←[0m] ←[32mINFO←[0m: Waiting for application startup. Orch decision length: 3 Task exception was never retrieved future: <Task finished name='Task-3' coro=<OrchHandler.monitor_states() done, defined at E:\Matthias\GitHub\helao-dev\core\classes.py:102> exception=ValueError('Set of coroutines/Futures is empty.')> Traceback (most recent call last): File "E:\Matthias\GitHub\helao-dev\core\classes.py", line 106, in monitor_states await asyncio.wait([self.handle_socket(uri, k) for k, uri in self.fastSockets.items()]) File "C:\ProgramData\Miniconda3\envs\helao\lib\asyncio\tasks.py", line 413, in wait raise ValueError('Set of coroutines/Futures is empty.') ValueError: Set of coroutines/Futures is empty. ←[32mINFO←[0m: Application startup complete. ←[32mINFO←[0m: Uvicorn running on ←[1mhttp://127.0.0.1:8010←[0m (Press CTRL+C to quit) Launching visualizer group. CTRL-x to terminate process group. CTRL-d to disconnect. [('orchestrator', '127.0.0.1', 8010, 22688)] Successfully terminated server 'orchestrator'. All processes terminated. Removing 'pids_world.pck'

(helao) E:\Matthias\GitHub\helao-dev>

onepunchdan commented 3 years ago

I don't see a valid use case to start an orchestrator without any references to other fastapi servers, i.e. nothing to orchestrate. The monitor_states() method is supposed to be an infinite-running coroutine that monitors the action server websockets, but we can properly exit the task in case there are no websockets to monitor. Another approach might be to invalidate the config file with helao.py if there aren't any instrument or action servers to orchestrate.