diff --git a/distributed/scheduler.py b/distributed/scheduler.py index c6b12e14e93..a372ab238c0 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -271,6 +271,12 @@ def __init__( self.extra = extra or {} + def __hash__(self): + return hash((self.name, self.host)) + + def __eq__(self, other): + return type(self) == type(other) and hash(self) == hash(other) + @property def host(self): return get_address_host(self.address) @@ -2557,7 +2563,7 @@ def handle_release_data(self, key=None, worker=None, client=None, **msg): if ts is None: return ws = self.workers[worker] - if ts.processing_on is not ws: + if ts.processing_on != ws: return r = self.stimulus_missing_data(key=key, ensure=False, **msg) self.transitions(r) @@ -4020,7 +4026,7 @@ def transition_processing_memory( if ws is None: return {key: "released"} - if ws is not ts.processing_on: # someone else has this task + if ws != ts.processing_on: # someone else has this task logger.info( "Unexpected worker completed task, likely due to" " work stealing. Expected: %s, Got: %s, Key: %s",