Skip to content

Commit

Permalink
Assert that a fetch->cancelled->resumed->fetch cycle is impossible
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Jun 1, 2022
1 parent 715d7be commit 7a084a7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,16 @@ 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
)
if self.validate:
# This would only be possible in a fetch->cancelled->resumed->fetch loop,
# but there are no transitions from fetch which set the state to cancelled.
# If this assertion failed, we' need to call _ensure_communicating like in
# the other transitions that set ts.status = "fetch".
assert ts.state != "fetch"
return recs, instructions

def transition_resumed_missing(
self, ts: TaskState, *, stimulus_id: str
Expand Down

0 comments on commit 7a084a7

Please sign in to comment.