MCPcopy
hub / github.com/dask/dask / _simplify_down

Method _simplify_down

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

Source from the content-addressed store, hash-verified

1230 return iter(self.operands)
1231
1232 def _simplify_down(self):
1233 from dask.highlevelgraph import HighLevelGraph
1234
1235 issue_warning = False
1236 hlgs = []
1237 if any(
1238 isinstance(op, (HLGExpr, HLGFinalizeCompute, dict)) for op in self.operands
1239 ):
1240 for op in self.operands:
1241 if isinstance(op, (HLGExpr, HLGFinalizeCompute)):
1242 hlgs.append(op)
1243 elif isinstance(op, dict):
1244 hlgs.append(
1245 HLGExpr(
1246 dsk=HighLevelGraph.from_collections(
1247 str(id(op)), op, dependencies=()
1248 )
1249 )
1250 )
1251 else:
1252 issue_warning = True
1253 opt = op.optimize()
1254 hlgs.append(
1255 HLGExpr(
1256 dsk=HighLevelGraph.from_collections(
1257 opt._name, opt.__dask_graph__(), dependencies=()
1258 )
1259 )
1260 )
1261 if issue_warning:
1262 warnings.warn(
1263 "Computing mixed collections that are backed by "
1264 "HighlevelGraphs/dicts and Expressions. "
1265 "This forces Expressions to be materialized. "
1266 "It is recommended to use only one type and separate the dask."
1267 "compute calls if necessary.",
1268 UserWarning,
1269 )
1270 if not hlgs:
1271 return None
1272 return _HLGExprSequence(*hlgs)
1273
1274
1275class _AnnotationsTombstone: ...

Callers

nothing calls this directly

Calls 6

anyFunction · 0.85
HLGExprClass · 0.85
_HLGExprSequenceClass · 0.85
from_collectionsMethod · 0.80
optimizeMethod · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected