From a8cf0e01fb40488c7c2da6d65a120e9217ba8213 Mon Sep 17 00:00:00 2001 From: rockwellw Date: Fri, 13 Dec 2019 10:48:47 -0800 Subject: [PATCH 1/3] Check equality, not identity --- distributed/scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distributed/scheduler.py b/distributed/scheduler.py index c6b12e14e93..14117d3c43e 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -4020,7 +4020,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", From f0f8d874831b38978c9cefa227a70fcd8d3f9f5b Mon Sep 17 00:00:00 2001 From: rockwellw Date: Mon, 27 Jan 2020 09:50:32 -0800 Subject: [PATCH 2/3] Update equality check in `handle_release_data` --- distributed/scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distributed/scheduler.py b/distributed/scheduler.py index 14117d3c43e..8e6b8d60505 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -2557,7 +2557,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) From 6fe259ebed4d585168d330bd8c24d3a647b8c1e7 Mon Sep 17 00:00:00 2001 From: Brett Naul Date: Mon, 10 Feb 2020 09:15:30 -0800 Subject: [PATCH 3/3] Define __eq__ and __hash__ for WorkerState --- distributed/scheduler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/distributed/scheduler.py b/distributed/scheduler.py index 8e6b8d60505..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)