How Does Dask.delayed Handle Mutable Inputs?
If I have an mutable object, let's say for example a dict, how does dask handle passing that as an input to delayed functions? Specifically if I make updates to the dict between de
Solution 1:
Dask does not support mutable inputs. Dask expects inputs to not change. Dask also expects functions to not mutate inputs inplace.
It turns out to be hard to support both mutation and resilience at the same time.
In this case it looks like dask has deconstructed your dictionary into another object. Dictionaries are special in this case. I would not expect this behavior for most mutable objects
In [1]: from dask import delayed
In [2]: x = {}
In [3]: foo = delayed(print)
In [4]: p1 = foo(x)
In [5]: dict(p1.__dask_graph__())
Out[5]: {'print-26d52543-57fc-4873-9722-1a8fd2f1641c': (<function print>, (dict, []))}
Post a Comment for "How Does Dask.delayed Handle Mutable Inputs?"