Check that two tasks (possibly containing nested tasks) are equal, where equality is lax by allowing the callable in a SubgraphCallable to be the same as a non-wrapped task.
(a, b)
| 18 | |
| 19 | |
| 20 | def _check_get_task_eq(a, b) -> bool: |
| 21 | """ |
| 22 | Check that two tasks (possibly containing nested tasks) are equal, where |
| 23 | equality is lax by allowing the callable in a SubgraphCallable to be the same |
| 24 | as a non-wrapped task. |
| 25 | """ |
| 26 | if len(a) < 1 or len(a) != len(b): |
| 27 | return False |
| 28 | |
| 29 | a_callable = a[0] |
| 30 | b_callable = b[0] |
| 31 | if a_callable != b_callable: |
| 32 | return False |
| 33 | |
| 34 | for ae, be in zip(a[1:], b[1:]): |
| 35 | if dask.core.istask(ae): |
| 36 | if not _check_get_task_eq(ae, be): |
| 37 | return False |
| 38 | elif ae != be: |
| 39 | return False |
| 40 | return True |
| 41 | |
| 42 | |
| 43 | def test_optimize_with_getitem_fusion(): |
nothing calls this directly
no outgoing calls
no test coverage detected