Skip to content

Commit

Permalink
propogate error from scan method
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Nov 11, 2024
1 parent 93e1275 commit 3cd53f9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/fastcs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ def _run_initial_tasks(self):
future.result()

def _start_scan_tasks(self):
scan_tasks = _get_scan_tasks(self._mapping)

for task in scan_tasks:
asyncio.run_coroutine_threadsafe(task(), self._loop)
async def run_tasks():
futures = [task() for task in _get_scan_tasks(self._mapping)]
for future in asyncio.as_completed(futures):
try:
await future
except Exception as e:
raise e

future = asyncio.run_coroutine_threadsafe(run_tasks(), self._loop)
future.result()

def _run(self):
raise NotImplementedError("Specific Backend must implement _run")
Expand Down

0 comments on commit 3cd53f9

Please sign in to comment.