MCPcopy
hub / github.com/dask/dask / __dask_graph__

Method __dask_graph__

dask/_expr.py:1391–1418  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1389 return self.expr
1390
1391 def __dask_graph__(self):
1392 try:
1393 from distributed.shuffle._core import P2PBarrierTask
1394 except ModuleNotFoundError:
1395 P2PBarrierTask = type(None)
1396 dsk = convert_legacy_graph(self.expr.__dask_graph__())
1397
1398 subs = {old_key: self._modify_keys(old_key) for old_key in dsk}
1399 dsk2 = {}
1400 for old_key, new_key in subs.items():
1401 t = dsk[old_key]
1402 if isinstance(t, P2PBarrierTask):
1403 warnings.warn(
1404 "Cannot block reusing for graphs including a "
1405 "P2PBarrierTask. This may cause unexpected results. "
1406 "This typically happens when converting a dask "
1407 "DataFrame to delayed objects.",
1408 UserWarning,
1409 )
1410 return dsk
1411 dsk2[new_key] = Task(
1412 new_key,
1413 ProhibitReuse._identity,
1414 t.substitute(subs),
1415 )
1416
1417 dsk2.update(dsk)
1418 return dsk2
1419
1420 _layer = __dask_graph__

Callers

nothing calls this directly

Calls 6

_modify_keysMethod · 0.95
convert_legacy_graphFunction · 0.90
TaskClass · 0.90
__dask_graph__Method · 0.45
itemsMethod · 0.45
substituteMethod · 0.45

Tested by

no test coverage detected