使用客户端检索,查看结果和取消期货

时间:2017-08-25 20:07:11

标签: dask dask-distributed

场景:用户A连接到dask调度程序,使用client.map(func, list)发送长作业并在周末注销。用户B想要查看用户A创建的已完成期货的结果,并可能取消待定期货。

我们设法得到工人的期货结果如下:

from dask.distributed import Client
from distributed.client import Future

client = Client("tcp://scheduler_ip:8786")
for worker, futures in client.has_what().items():
    for future_id in futures:
        f = Future(future_id, client)
        f._state.status = "finished"
        print(f.result())

f.cancel()什么都不做。有没有办法实现这个目标?

1 个答案:

答案 0 :(得分:0)

股票期货

您可以考虑使用变量和队列等构造共享期货。有关详细信息,请参阅these docs

取消期货

如果任务尚未启动,则取消将停止任务。不幸的是,一旦一个函数开始运行,就没有办法阻止它杀死那个工人。

相关问题