File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515from distributed .worker import Worker
1616
1717
18- # Close gracefully when receiving a SIGINT
19- # We use SIGINT to shut down because the scheduler and worker hang
20- # if we call sys.exit() see https://github.com/dask/distributed/issues/8644
21- if threading .current_thread () is threading .main_thread ():
22- signal .signal (signal .SIGINT , lambda * _ : sys .exit ())
18+ def setup_signal_handler ():
19+ # Close gracefully when receiving a SIGINT
20+ # We use SIGINT to shut down because the scheduler and worker hang
21+ # if we call sys.exit() see https://github.com/dask/distributed/issues/8644
22+ if threading .current_thread () is threading .main_thread ():
23+ signal .signal (signal .SIGINT , lambda * _ : sys .exit ())
2324
2425
2526class Role (Enum ):
@@ -68,6 +69,7 @@ def __init__(
6869 asynchronous : bool = False ,
6970 loop : asyncio .BaseEventLoop = None ,
7071 ):
72+ setup_signal_handler ()
7173 self .status = Status .created
7274 self .scheduler = scheduler
7375 self .scheduler_address = None
You can’t perform that action at this time.
0 commit comments