Skip to content

Commit

Permalink
Use list comprehensions to bind TaskGroup type (#4401)
Browse files Browse the repository at this point in the history
As Cython doesn't track typed variables in generator expressions well,
use `list` comprehensions, which Cython does type correctly.
  • Loading branch information
jakirkham authored Jan 6, 2021
1 parent a07fc39 commit eeb411e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def active(self):
return [
tg
for tg in self._groups
if any(v != 0 for k, v in tg._states.items() if k != "forgotten")
if any([v != 0 for k, v in tg._states.items() if k != "forgotten"])
]

@property
Expand Down Expand Up @@ -5570,7 +5570,7 @@ def transition(self, key, finish, *args, **kwargs):
if ts._state == "forgotten" and ts._group._name in self.task_groups:
# Remove TaskGroup if all tasks are in the forgotten state
tg: TaskGroup = ts._group
if not any(tg._states.get(s) for s in ALL_TASK_STATES):
if not any([tg._states.get(s) for s in ALL_TASK_STATES]):
ts._prefix._groups.remove(tg)
del self.task_groups[tg._name]

Expand Down

0 comments on commit eeb411e

Please sign in to comment.