MCPcopy
hub / github.com/dask/dask / TaskRef

Class TaskRef

dask/_task_spec.py:333–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331
332
333class TaskRef:
334 val: KeyType
335 __slots__ = ("key",)
336
337 def __init__(self, key: KeyType):
338 self.key = key
339
340 def __str__(self):
341 return str(self.key)
342
343 def __repr__(self):
344 return f"{type(self).__name__}({self.key!r})"
345
346 def __hash__(self) -> int:
347 return hash(self.key)
348
349 def __eq__(self, value: object) -> bool:
350 if not isinstance(value, TaskRef):
351 return False
352 return self.key == value.key
353
354 def __reduce__(self):
355 return TaskRef, (self.key,)
356
357 def substitute(self, subs: dict, key: KeyType | None = None) -> TaskRef | GraphNode:
358 if self.key in subs:
359 val = subs[self.key]
360 if isinstance(val, GraphNode):
361 return val.substitute({}, key=self.key)
362 elif isinstance(val, TaskRef):
363 return val
364 else:
365 return TaskRef(val)
366 return self
367
368
369def _is_dask_future(obj: object) -> bool:

Callers 15

__init__Method · 0.90
sanitize_dskFunction · 0.90
_build_map_layerFunction · 0.90
_convert_dask_keysFunction · 0.90
_convert_dask_keysFunction · 0.90
unpack_collectionsFunction · 0.90
_unpackFunction · 0.90
cloneMethod · 0.90
_lol_productFunction · 0.90
from_delayedFunction · 0.90
build_argsFunction · 0.90
build_bag_kwargsFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_task_eqFunction · 0.72
test_reference_remoteFunction · 0.72
test_pickle_sizeFunction · 0.72
test_avoid_cyclesFunction · 0.72
test_parse_namedtupleFunction · 0.72
test_resolve_aliasesFunction · 0.72
test_parse_nestedFunction · 0.72
test_fuse_tasksFunction · 0.72
test_nested_containersFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…