MCPcopy Index your code
hub / github.com/dask/dask / test_array_delayed_complex_optimization_kwargs

Function test_array_delayed_complex_optimization_kwargs

dask/tests/test_delayed.py:598–626  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

596
597
598def test_array_delayed_complex_optimization_kwargs():
599 # Ensure that collections that if multiple collections are passed to a
600 # Delayed function that they are optimized together
601 np = pytest.importorskip("numpy")
602 pytest.importorskip("dask.array")
603 from dask.array.core import from_func
604 from dask.array.utils import assert_eq
605
606 called = False
607
608 def only_once():
609 nonlocal called
610 if called:
611 raise RuntimeError("Already executed")
612
613 called = True
614 return np.arange(100).reshape((10, 10))
615
616 darr = from_func(only_once, shape=(10, 10), dtype=int)
617 a = darr + 1
618 b = darr + 2
619
620 def sum_kwargs_only(*, a, b, c):
621 return sum([a, b, c])
622
623 val = delayed(sum_kwargs_only)(a=a, b=b, c=1)
624 assert isinstance(val, Delayed)
625 np_arr = np.arange(100).reshape((10, 10))
626 assert_eq(val.compute(), (np_arr + 1) + (np_arr + 2) + 1)
627
628
629def test_array_bag_delayed():

Callers

nothing calls this directly

Calls 6

from_funcFunction · 0.90
delayedFunction · 0.90
assert_eqFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…