场景:用户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()
什么都不做。有没有办法实现这个目标?
答案 0 :(得分:0)
您可以考虑使用变量和队列等构造共享期货。有关详细信息,请参阅these docs。
如果任务尚未启动,则取消将停止任务。不幸的是,一旦一个函数开始运行,就没有办法阻止它杀死那个工人。