From eeb411e37f6ce754b800358462bf6c2a8a37f437 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 6 Jan 2021 09:36:32 -0800 Subject: [PATCH] Use `list` comprehensions to bind `TaskGroup` type (#4401) As Cython doesn't track typed variables in generator expressions well, use `list` comprehensions, which Cython does type correctly. --- distributed/scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distributed/scheduler.py b/distributed/scheduler.py index a29560617d9..af282263884 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -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 @@ -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]