MCPcopy
hub / github.com/dask/dask / _can_fuse_annotations

Function _can_fuse_annotations

dask/blockwise.py:1211–1225  ·  view source on GitHub ↗

Treat the special annotation keys, as fusable since we can apply simple rules to capture their intent in a fused layer.

(a: dict | None, b: dict | None)

Source from the content-addressed store, hash-verified

1209
1210
1211def _can_fuse_annotations(a: dict | None, b: dict | None) -> bool:
1212 """
1213 Treat the special annotation keys, as fusable since we can apply simple
1214 rules to capture their intent in a fused layer.
1215 """
1216 if a == b:
1217 return True
1218
1219 if dask.config.get("optimization.annotations.fuse") is False:
1220 return False
1221
1222 fusable = {"retries", "priority", "resources", "workers", "allow_other_workers"}
1223 return (not a or all(k in fusable for k in a)) and (
1224 not b or all(k in fusable for k in b)
1225 )
1226
1227
1228def _fuse_annotations(*args: dict) -> dict:

Callers 1

_optimize_blockwiseFunction · 0.85

Calls 2

allFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…