MCPcopy
hub / github.com/dask/dask / test_fused_ensure_only_executed_once

Function test_fused_ensure_only_executed_once

dask/tests/test_task_spec.py:809–824  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

807
808
809def test_fused_ensure_only_executed_once():
810 counter = []
811
812 def counter_func(a, b):
813 counter.append(None)
814 return func(a, b)
815
816 a = Task("key-1", counter_func, "a", "a")
817 b = Task("key-2", func2, a.ref(), "b")
818 c = Task("key-3", func2, a.ref(), "c")
819 d = Task("key-4", func, b.ref(), c.ref())
820 for perm in itertools.permutations([a, b, c, d]):
821 fused = Task.fuse(*perm)
822 counter.clear()
823 assert fused() == func(func2(func("a", "a"), "b"), func2(func("a", "a"), "c"))
824 assert len(counter) == 1
825
826
827def test_fused_dont_hold_in_memory_too_long():

Callers

nothing calls this directly

Calls 6

TaskClass · 0.90
refMethod · 0.80
funcFunction · 0.70
func2Function · 0.70
fuseMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…