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 delayed calls?
I tried the following example which seems to suggest that some copying is going on but can you elaborate what exactly dask is doing?
In [3]: from dask import delayed
In [4]: x = {}
In [5]: foo = delayed(print)
In [6]: foo(x)
Out[6]: Delayed('print-73930550-94a6-43f9-80ab-072bc88c2b88')
In [7]: foo(x).compute()
{}
In [8]: p1 = foo(x)
In [9]: x['a'] = 1
In [10]: p2 = foo(x)
In [11]: p1.compute()
{}
In [12]: p2.compute()
{'a': 1}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…