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

Method __dask_graph__

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

Source from the content-addressed store, hash-verified

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