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

Method __dask_graph__

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

Source from the content-addressed store, hash-verified

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