MCPcopy Create free account
hub / github.com/dask/dask / test_annotations_leak

Function test_annotations_leak

dask/tests/test_highgraph.py:214–231  ·  view source on GitHub ↗

Annotations shouldn't leak between threads. See https://github.com/dask/dask/issues/10340.

()

Source from the content-addressed store, hash-verified

212
213
214def test_annotations_leak():
215 """Annotations shouldn't leak between threads.
216 See https://github.com/dask/dask/issues/10340."""
217 b1 = threading.Barrier(2)
218 b2 = threading.Barrier(2)
219
220 def f(n):
221 with dask.annotate(foo=n):
222 b1.wait()
223 out = dask.get_annotations()
224 b2.wait()
225 return out
226
227 with ThreadPoolExecutor(2) as ex:
228 f1 = ex.submit(f, 1)
229 f2 = ex.submit(f, 2)
230 result = [f1.result(), f2.result()]
231 assert result == [{"foo": 1}, {"foo": 2}]
232
233
234@pytest.mark.parametrize("flat", [True, False])

Callers

nothing calls this directly

Calls 1

submitMethod · 0.45

Tested by

no test coverage detected