()
| 170 | |
| 171 | |
| 172 | def test_multiple_annotations(): |
| 173 | pytest.importorskip("numpy") |
| 174 | da = pytest.importorskip("dask.array") |
| 175 | with dask.annotate(block_id=annot_map_fn): |
| 176 | with dask.annotate(resources={"GPU": 1}): |
| 177 | A = da.ones((10, 10), chunks=(5, 5)) |
| 178 | |
| 179 | B = A + 1 |
| 180 | |
| 181 | C = B + 1 |
| 182 | |
| 183 | assert not dask.get_annotations() |
| 184 | |
| 185 | alayer = A.__dask_graph__().layers[A.name] |
| 186 | blayer = B.__dask_graph__().layers[B.name] |
| 187 | clayer = C.__dask_graph__().layers[C.name] |
| 188 | assert alayer.annotations == {"resources": {"GPU": 1}, "block_id": annot_map_fn} |
| 189 | assert blayer.annotations == {"block_id": annot_map_fn} |
| 190 | assert clayer.annotations is None |
| 191 | |
| 192 | |
| 193 | def test_annotation_cleared_on_error(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…