MCPcopy
hub / github.com/dask/dask / test_complex_ordering

Function test_complex_ordering

dask/tests/test_local.py:176–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175
176def test_complex_ordering():
177 pytest.importorskip("numpy")
178 da = pytest.importorskip("dask.array")
179 from dask.diagnostics import Callback
180
181 actual_order = []
182
183 def track_order(key, dask, state):
184 actual_order.append(key)
185
186 x = da.random.normal(size=(20, 20), chunks=(-1, -1))
187 res = (x.dot(x.T) - x.mean(axis=0)).std()
188 dsk = dict(res.__dask_graph__())
189 exp_order_dict = order(dsk)
190 exp_order = sorted(exp_order_dict.keys(), key=exp_order_dict.get)
191 with Callback(pretask=track_order):
192 get_sync(dsk, exp_order[-1])
193 assert actual_order == exp_order
194
195
196def test_ensure_calculate_only_whats_needed():

Callers

nothing calls this directly

Calls 9

orderFunction · 0.90
get_syncFunction · 0.90
CallbackClass · 0.85
normalMethod · 0.45
stdMethod · 0.45
dotMethod · 0.45
meanMethod · 0.45
__dask_graph__Method · 0.45
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…