如果我有一个可变对象,例如一个 dict,dask 如何处理将其作为输入传递给延迟函数?特别是如果我在延迟调用之间对字典进行更新?
我尝试了以下示例,这似乎表明正在进行一些复制,但您能详细说明 dask 到底在做什么吗?
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}