Skip to content

Commit

Permalink
Fix signal manager class vars
Browse files Browse the repository at this point in the history
  • Loading branch information
filipcacky committed Oct 22, 2024
1 parent 32c0e0d commit 81da2df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions metaflow/runner/signal_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
import signal
from typing import NewType, Mapping, Set, Callable, Optional
from typing import NewType, MutableMapping, Set, Callable, Optional

SignalHandler = NewType("SignalHandler", Callable[[int, []], None])

Expand All @@ -27,8 +27,8 @@ class SignalManager:

hook_signals: bool
event_loop: Optional[asyncio.AbstractEventLoop]
signal_map: Mapping[int, Set[SignalHandler]] = dict()
replaced_signals: Mapping[int, SignalHandler] = dict()
signal_map: MutableMapping[int, Set[SignalHandler]]
replaced_signals: MutableMapping[int, SignalHandler]

def __init__(
self,
Expand All @@ -41,6 +41,9 @@ def __init__(
except RuntimeError:
self.event_loop = None

self.signal_map = {}
self.replaced_signals = {}

def __exit__(self, exc_type, exc_value, traceback):
for sig in self.signal_map:
self._maybe_remove_signal_handler(sig)
Expand Down

0 comments on commit 81da2df

Please sign in to comment.