Skip to content

Commit 2dbb648

Browse files
committed
Remove expensive tokenization for key uniqueness check
1 parent 55bb639 commit 2dbb648

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

distributed/scheduler.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import dask
5656
import dask.utils
5757
from dask._task_spec import DependenciesMapping, GraphNode, convert_legacy_graph
58-
from dask.base import TokenizationError, normalize_token, tokenize
5958
from dask.core import istask, validate_key
6059
from dask.typing import Key, no_default
6160
from dask.utils import (
@@ -4985,25 +4984,14 @@ def _generate_taskstates(
49854984
# run_spec in the submitted graph may be None. This happens
49864985
# when an already persisted future is part of the graph
49874986
elif k in dsk:
4988-
# If both tokens are non-deterministic, skip comparison
4989-
try:
4990-
tok_lhs = tokenize(ts.run_spec, ensure_deterministic=True)
4991-
except TokenizationError:
4992-
tok_lhs = ""
4993-
try:
4994-
tok_rhs = tokenize(dsk[k], ensure_deterministic=True)
4995-
except TokenizationError:
4996-
tok_rhs = ""
4997-
4998-
# Additionally check dependency names. This should only be necessary
4999-
# if run_specs can't be tokenized deterministically.
4987+
# Check dependency names.
50004988
deps_lhs = {dts.key for dts in ts.dependencies}
50014989
deps_rhs = dependencies[k]
50024990

50034991
# FIXME It would be a really healthy idea to change this to a hard
50044992
# failure. However, this is not possible at the moment because of
50054993
# https://github.com/dask/dask/issues/9888
5006-
if tok_lhs != tok_rhs or deps_lhs != deps_rhs:
4994+
if deps_lhs != deps_rhs:
50074995
# Retain old run_spec and dependencies; rerun them if necessary.
50084996
# This sweeps the issue of collision under the carpet as long as the
50094997
# old and new task produce the same output - such as in
@@ -5029,8 +5017,6 @@ def _generate_taskstates(
50295017
old task state: {ts.state}
50305018
old run_spec: {ts.run_spec!r}
50315019
new run_spec: {dsk[k]!r}
5032-
old token: {normalize_token(ts.run_spec)!r}
5033-
new token: {normalize_token(dsk[k])!r}
50345020
old dependencies: {deps_lhs}
50355021
new dependencies: {deps_rhs}
50365022
"""

0 commit comments

Comments
 (0)