diff --git a/distributed/scheduler.py b/distributed/scheduler.py index f8a26d59d4..104ae5e0b3 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -1428,6 +1428,7 @@ def __init__( run_spec: T_runspec | None, state: TaskStateState, group: TaskGroup, + validate: bool, ): # Most of the attributes below are not initialized since there are not # always required for every tasks. Particularly for large graphs, these @@ -1468,7 +1469,8 @@ def __init__( self.run_id = None self.group = group group.add(self) - TaskState._instances.add(self) + if validate: + TaskState._instances.add(self) def __hash__(self) -> int: return self._hash @@ -1890,7 +1892,7 @@ def new_task( if computation: computation.groups.add(tg) - ts = TaskState(key, spec, state, tg) + ts = TaskState(key, spec, state, tg, validate=self.validate) self.tasks[key] = ts