dask:与as_complet的异步相当于什么?
continue
I have a working Dask client code like that :
client = Client(address=self.cluster)
futures = []
for job in jobs:
future = client.submit(...)
futures.append(future)
for future, result in as_completed(futures, with_results=True, raise_errors=True):
key = future.key
state = (State.FINISHED if result is True else State.FAILED)
...
The Dask as_completed
function is relevant, because it iterate on job that have finished with the good order.
The problem with that code, is it may block indefinitely on the as_completed
call, in case of the workers are not available for instance.
Is there a way to rewrite it with asyncio
? Indeed, with asyncio
, I may use the wait
function with a timeout, in order to unblock blocking call, in case of errors.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
asyncio.as_completed
https://docs .python.org/3/library/asyncio-task.htmlYou can use
asyncio.as_completed
https://docs.python.org/3/library/asyncio-task.html