Skip to content

Commit

Permalink
hardcode wait_for_signals signal list (#6619)
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert authored Jun 24, 2022
1 parent dc019ed commit becb366
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions distributed/_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
logger = logging.getLogger(__name__)


async def wait_for_signals(signals: list[signal.Signals]) -> None:
"""Wait for the passed signals by setting global signal handlers"""
async def wait_for_signals() -> None:
"""Wait for sigint or sigterm by setting global signal handlers"""
signals = (signal.SIGINT, signal.SIGTERM)
loop = asyncio.get_running_loop()
event = asyncio.Event()

Expand Down
3 changes: 1 addition & 2 deletions distributed/cli/dask_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import os
import re
import signal
import sys
import warnings

Expand Down Expand Up @@ -205,7 +204,7 @@ async def wait_for_scheduler_to_finish():

async def wait_for_signals_and_close():
"""Wait for SIGINT or SIGTERM and close the scheduler upon receiving one of those signals"""
await wait_for_signals([signal.SIGINT, signal.SIGTERM])
await wait_for_signals()
await scheduler.close()

wait_for_signals_and_close_task = asyncio.create_task(
Expand Down
3 changes: 1 addition & 2 deletions distributed/cli/dask_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import gc
import logging
import os
import signal
import sys
import warnings
from collections.abc import Iterator
Expand Down Expand Up @@ -476,7 +475,7 @@ async def wait_for_nannies_to_finish():
async def wait_for_signals_and_close():
"""Wait for SIGINT or SIGTERM and close all nannies upon receiving one of those signals"""
nonlocal signal_fired
await wait_for_signals([signal.SIGINT, signal.SIGTERM])
await wait_for_signals()

signal_fired = True
if nanny:
Expand Down

0 comments on commit becb366

Please sign in to comment.