Skip to content

Commit 2d419ff

Browse files
authored
Handle CancelledError gracefully during job cleanup (#662)
1 parent 36ab8b2 commit 2d419ff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cloudai/_core/runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ async def run(self):
8585
try:
8686
await self.runner.run()
8787
logging.debug("All jobs finished successfully.")
88+
except asyncio.CancelledError:
89+
logging.info("Runner cancelled, performing cleanup...")
90+
await self.runner.shutdown()
91+
return
8892
except JobFailureError as exc:
8993
logging.debug(f"Runner failed JobFailure exception: {exc}", exc_info=True)
9094

0 commit comments

Comments
 (0)