From d589739e7e48320f5170a44b8ff192f71688ded3 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Thu, 26 May 2022 16:04:20 +0100 Subject: [PATCH] Assert that a fetch->cancelled->resumed->fetch cycle is impossible --- distributed/worker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/distributed/worker.py b/distributed/worker.py index 1795bb80c59..37706cb63bb 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -2329,7 +2329,14 @@ def transition_resumed_fetch( self, ts: TaskState, *, stimulus_id: str ) -> RecsInstrs: """See Worker._transition_from_resumed""" - return self._transition_from_resumed(ts, "fetch", stimulus_id=stimulus_id) + recs, instructions = self._transition_from_resumed( + ts, "fetch", stimulus_id=stimulus_id + ) + # This would only be possible in a fetch->cancelled->fetch loop, but there's + # no such transition from fetch which sets the state to cancelled. + # Thus, there's no need to call _ensure_communicating. + assert ts.state != "fetch" + return recs, instructions def transition_resumed_missing( self, ts: TaskState, *, stimulus_id: str