MCPcopy
hub / github.com/dask/dask / test_avoid_upwards_branching_complex

Function test_avoid_upwards_branching_complex

dask/tests/test_order.py:379–416  ·  view source on GitHub ↗

r""" a1 | e2 a2 d2 d3 | | \ / e1 a3 d1 \ / \ / b1 c1 | | b2 c2 | c3 Prefer c1 over b1 because c1 will stay in memory less long while b1 computes

(abcde)

Source from the content-addressed store, hash-verified

377
378
379def test_avoid_upwards_branching_complex(abcde):
380 r"""
381 a1
382 |
383 e2 a2 d2 d3
384 | | \ /
385 e1 a3 d1
386 \ / \ /
387 b1 c1
388 | |
389 b2 c2
390 |
391 c3
392
393 Prefer c1 over b1 because c1 will stay in memory less long while b1
394 computes
395 """
396 a, b, c, d, e = abcde
397 dsk = {
398 (a, 1): (f, (a, 2)),
399 (a, 2): (f, (a, 3)),
400 (a, 3): (f, (b, 1), (c, 1)),
401 (b, 1): (f, (b, 2)),
402 (b, 2): (f,),
403 (c, 1): (f, (c, 2)),
404 (c, 2): (f, (c, 3)),
405 (c, 3): (f,),
406 (d, 1): (f, (c, 1)),
407 (d, 2): (f, (d, 1)),
408 (d, 3): (f, (d, 1)),
409 (e, 1): (f, (b, 1)),
410 (e, 2): (f, (e, 1)),
411 }
412
413 o = order(dsk)
414 assert_topological_sort(dsk, o)
415 assert o[(c, 1)] < o[(b, 1)]
416 assert abs(o[(d, 2)] - o[(d, 3)]) == 1
417
418
419def test_deep_bases_win_over_dependents(abcde):

Callers

nothing calls this directly

Calls 2

orderFunction · 0.90
assert_topological_sortFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…