MCPcopy Index your code
hub / github.com/dask/dask / test_multiple_annotations

Function test_multiple_annotations

dask/tests/test_highgraph.py:172–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170
171
172def 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
193def test_annotation_cleared_on_error():

Callers

nothing calls this directly

Calls 2

onesMethod · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…