【问题标题】:Access tasks results launched by other tasks in Dask访问 Dask 中其他任务启动的任务结果
【发布时间】:2020-01-26 18:59:17
【问题描述】:

我的应用程序要求我从其他任务中启动任务,如下所示

def a():
    # ... some computation ..

def b():
    # ... some computation ..

def c():
    client = get_client()
    a = client.submit(a)
    b = client.submit(b)

    [a,b] = client.gather([a,b])

    return a+b

client = get_client()
res = client.submit(c)

但是,我想访问中间结果 ab(当调用 c 时),但只有 c 出现在 client.futures 中。

有没有办法告诉 dask 保留 ab 的结果?

我尝试使用 Future.add_done_callback 方法,但它不适用于其他 submit 调用中的 submit 调用。

谢谢

【问题讨论】:

    标签: dask distributed


    【解决方案1】:

    您可能想查看 Dask 的协调原语,例如共享变量、队列和发布/订阅。 https://docs.dask.org/en/latest/futures.html#coordination-primitives

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-25
      • 1970-01-01
      • 2017-03-08
      • 2022-01-19
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多