Skip to content

Commit

Permalink
Nexus empty fork fix (#132)
Browse files Browse the repository at this point in the history
* Nexus empty fork fix

* Update forked_algorithm.py

* Update forked_algorithm.py
  • Loading branch information
henrikfoss authored Jan 28, 2025
1 parent 01b578c commit 9312f81
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions esd_services_api_client/nexus/algorithms/forked_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ async def _measured_run(**run_args) -> AlgorithmResult:
self._get_forks, **self._inputs, **kwargs
)()

if len(forks) > 0:
self._logger.info(
"Forking node with: {forks}, after the node run",
forks=",".join([fork.alias() for fork in forks]),
)
else:
self._logger.info("Leaf algorithm node: proceeding with this node run only")

run_result = await partial(
_measured_run,
**kwargs,
Expand All @@ -170,7 +162,15 @@ async def _measured_run(**run_args) -> AlgorithmResult:
logger=self._logger,
)()

# now await callback scheduling
await asyncio.wait([asyncio.create_task(fork.run(**kwargs)) for fork in forks])
if len(forks) > 0:
self._logger.info(
"Forking node with: {forks}, after the node run",
forks=",".join([fork.alias() for fork in forks]),
)
await asyncio.wait(
[asyncio.create_task(fork.run(**kwargs)) for fork in forks]
)
else:
self._logger.info("Leaf algorithm node: proceeding with this node run only")

return run_result

0 comments on commit 9312f81

Please sign in to comment.