Skip to content

Commit

Permalink
✨ Allow to cancel worker shutdown via SIGUSR1
Browse files Browse the repository at this point in the history
  • Loading branch information
phlmn committed Dec 10, 2023
1 parent d593f54 commit 4af0661
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions worker/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ async def run(args):
finish_event = asyncio.Event()
# stop the worker gracefully on SIGTERM
asyncio.get_running_loop().add_signal_handler(signal.SIGTERM, finish_event.set)
# allow to cancel shutdown via SIGUSR1
asyncio.get_running_loop().add_signal_handler(signal.SIGUSR1, finish_event.clear)

worker = Worker(
base_url=f"{args.coordinator}/api/v1/tasks",
Expand Down

0 comments on commit 4af0661

Please sign in to comment.