| 6205 | |
| 6206 | |
| 6207 | def test_blockwise_fusion(): |
| 6208 | def custom_scheduler_get(dsk, keys, **kwargs): |
| 6209 | """Custom scheduler that returns the result of the first key.""" |
| 6210 | dsk = dsk.__dask_graph__() |
| 6211 | # two sum |
| 6212 | # one sum agg |
| 6213 | # one finalize Alias |
| 6214 | assert len(dsk) == 4, "False number of tasks" |
| 6215 | return [42 for _ in keys] |
| 6216 | |
| 6217 | # First test that this mocking stuff works as expecged |
| 6218 | with pytest.raises(AssertionError, match="False number of tasks"): |
| 6219 | dask.compute(da.ones(10), scheduler=custom_scheduler_get) |
| 6220 | |
| 6221 | a = ((da.ones(10, chunks=5) + 1) + 2).sum() |
| 6222 | dask.compute(a, scheduler=custom_scheduler_get) |
| 6223 | |
| 6224 | |
| 6225 | @pytest.mark.skipif( |