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)
| 1209 | |
| 1210 | |
| 1211 | def _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 | |
| 1228 | def _fuse_annotations(*args: dict) -> dict: |
no test coverage detected
searching dependent graphs…