MCPcopy
hub / github.com/pydata/xarray / test_async

Function test_async

xarray/tests/test_distributed.py:288–312  ·  view source on GitHub ↗
(c, s, a, b)

Source from the content-addressed store, hash-verified

286
287@gen_cluster(client=True)
288async def test_async(c, s, a, b) -> None:
289 x = create_test_data()
290 assert not dask.is_dask_collection(x)
291 y = x.chunk({"dim2": 4}) + 10
292 assert dask.is_dask_collection(y)
293 assert dask.is_dask_collection(y.var1)
294 assert dask.is_dask_collection(y.var2)
295
296 z = c.persist(y)
297 assert str(z)
298
299 assert dask.is_dask_collection(z)
300 assert dask.is_dask_collection(z.var1)
301 assert dask.is_dask_collection(z.var2)
302 assert len(y.__dask_graph__()) > len(z.__dask_graph__())
303
304 assert not futures_of(y)
305 assert futures_of(z)
306
307 future = c.compute(z)
308 w = await future
309 assert not dask.is_dask_collection(w)
310 assert_allclose(x + 10, w)
311
312 assert s.tasks
313
314
315def test_hdf5_lock() -> None:

Callers

nothing calls this directly

Calls 6

assert_allcloseFunction · 0.90
create_test_dataFunction · 0.85
chunkMethod · 0.45
persistMethod · 0.45
__dask_graph__Method · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…