2
>>> import asyncio
>>> help(asyncio.wait)
Help on function wait in module asyncio.tasks:
wait(fs, *, loop=None, timeout=None, return_when='ALL_COMPLETED')
Wait for the Futures and coroutines given by fs to complete.
Coroutines will be wrapped in Tasks.
Returns two sets of Future: (done, pending).
Usage:
done, pending = yield from asyncio.wait(fs)
Note: This does not raise TimeoutError! Futures that aren't done
when the timeout occurs are returned in the second set.
(END)
我不很明白最后一个音符在此帮助(什么是第二套?是它挂起/后处理组?我如何执行尚未完成的任务和结合完成和待处理的结果,然后保存在数据库中)
我的问题: 我与aiohttp使用asyncio,有数以百万计的网址,他们很少可能会引发超时错误。我想将它们发送到队列中进行重新处理,或者应该通过事件池进行处理。 PS:我不使用wait_for
方法。
我想运行尚未完成的任务以及(异步)。我怎么能再次通过event_loop)? – micheal 2015-03-04 06:43:15
@michael在等待超时后,待处理任务继续执行。它们不会被取消或中止或类似的事情。因此,无需重新安排它们的操作 - 只要您不停止事件循环,它们将继续在后台运行。 – dano 2015-03-17 20:17:00