MCPcopy Create free account
hub / github.com/dask/dask / __dask_graph__

Method __dask_graph__

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

Source from the content-addressed store, hash-verified

1453 return self.expr
1454
1455 def __dask_graph__(self):
1456 try:
1457 from distributed.shuffle._core import P2PBarrierTask
1458 except ModuleNotFoundError:
1459 P2PBarrierTask = type(None)
1460 dsk = convert_legacy_graph(self.expr.__dask_graph__())
1461
1462 subs = {old_key: self._modify_keys(old_key) for old_key in dsk}
1463 dsk2 = {}
1464 for old_key, new_key in subs.items():
1465 t = dsk[old_key]
1466 if isinstance(t, P2PBarrierTask):
1467 warnings.warn(
1468 "Cannot block reusing for graphs including a "
1469 "P2PBarrierTask. This may cause unexpected results. "
1470 "This typically happens when converting a dask "
1471 "DataFrame to delayed objects.",
1472 UserWarning,
1473 )
1474 return dsk
1475 dsk2[new_key] = Task(
1476 new_key,
1477 ProhibitReuse._identity,
1478 t.substitute(subs),
1479 )
1480
1481 dsk2.update(dsk)
1482 return dsk2
1483
1484 _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