Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions dask_jobqueue/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
from distributed.worker import Worker


# Close gracefully when receiving a SIGINT
# We use SIGINT to shut down because the scheduler and worker hang
# if we call sys.exit() see https://github.com/dask/distributed/issues/8644
if threading.current_thread() is threading.main_thread():
signal.signal(signal.SIGINT, lambda *_: sys.exit())


class Role(Enum):
"""
This Enum contains the various roles processes can be.
Expand Down Expand Up @@ -68,6 +61,11 @@ def __init__(
asynchronous: bool = False,
loop: asyncio.BaseEventLoop = None,
):
# Close gracefully when receiving a SIGINT
# We use SIGINT to shut down because the scheduler and worker hang
# if we call sys.exit() see https://github.com/dask/distributed/issues/8644
if threading.current_thread() is threading.main_thread():
signal.signal(signal.SIGINT, lambda *_: sys.exit())
self.status = Status.created
self.scheduler = scheduler
self.scheduler_address = None
Expand Down
Loading