diff --git a/distributed/cli/dask_scheduler.py b/distributed/cli/dask_scheduler.py index 94d82a44395..700765ba6fe 100755 --- a/distributed/cli/dask_scheduler.py +++ b/distributed/cli/dask_scheduler.py @@ -218,10 +218,12 @@ async def wait_for_signals_and_close(): wait_for_scheduler_to_finish() ) - await asyncio.wait( + done, _ = await asyncio.wait( [wait_for_signals_and_close_task, wait_for_scheduler_to_finish_task], return_when=asyncio.FIRST_COMPLETED, ) + # Re-raise exceptions from done tasks + [task.result() for task in done] logger.info("Stopped scheduler at %r", scheduler.address) try: