MCPcopy
hub / github.com/dask/dask / test_array_store_final_order

Function test_array_store_final_order

dask/tests/test_order.py:1080–1109  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

1078
1079
1080def test_array_store_final_order(tmpdir):
1081 # https://github.com/dask/dask/issues/6745
1082 # This essentially tests the same thing as test_terminal_node_backtrack,
1083 # but with the graph actually generated by da.store.
1084 pytest.importorskip("numpy")
1085 da = pytest.importorskip("dask.array")
1086 zarr = pytest.importorskip("zarr")
1087
1088 arrays = [da.ones((110, 4), chunks=(100, 2)) for i in range(4)]
1089 x = da.concatenate(arrays, axis=0).rechunk((100, 2))
1090
1091 if Version(zarr.__version__) < Version("3.0.0.a0"):
1092 store = zarr.storage.DirectoryStore(tmpdir)
1093 else:
1094 store = zarr.storage.LocalStore(str(tmpdir), read_only=False)
1095
1096 root = zarr.group(store, overwrite=True)
1097 dest = root.empty_like(name="dest", data=x, chunks=x.chunksize, overwrite=True)
1098 d = x.store(dest, lock=False, compute=False)
1099 o = order(d.dask)
1100 assert_topological_sort(dict(d.dask), o)
1101 # Find the lowest store. Dask starts here.
1102 stores = [k for k in o if isinstance(k, tuple) and k[0].startswith("store-map-")]
1103 first_store = min(stores, key=lambda k: o[k])
1104 connected_stores = [k for k in stores if k[-1] == first_store[-1]]
1105 disconnected_stores = [k for k in stores if k[-1] != first_store[-1]]
1106
1107 connected_max = max(v for k, v in o.items() if k in connected_stores)
1108 disconnected_min = min(v for k, v in o.items() if k in disconnected_stores)
1109 assert connected_max < disconnected_min
1110
1111
1112def test_eager_to_compute_dependent_to_free_parent():

Callers

nothing calls this directly

Calls 8

orderFunction · 0.90
assert_topological_sortFunction · 0.85
minFunction · 0.85
maxFunction · 0.85
storeMethod · 0.80
onesMethod · 0.45
rechunkMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…