portage.util.futures.iter_completed module¶
- portage.util.futures.iter_completed.async_iter_completed(futures, max_jobs=None, max_load=None, loop=None)¶
An asynchronous version of iter_completed. This yields futures, which when done, result in a set of input futures that are done. This serves as a wrapper around portage’s internal TaskScheduler class, using standard asyncio interfaces.
- Parameters
futures (iterator) – iterator of asyncio.Future (or compatible)
max_jobs (int) – max number of futures to process concurrently (default is portage.util.cpuinfo.get_cpu_count())
max_load (int or float) – max load allowed when scheduling a new future, otherwise schedule no more than 1 future at a time (default is portage.util.cpuinfo.get_cpu_count())
loop (EventLoop) – event loop
- Returns
iterator of futures, which when done, result in a set of input futures that are done
- Return type
iterator
- portage.util.futures.iter_completed.iter_completed(futures, max_jobs=None, max_load=None, loop=None)¶
This is similar to asyncio.as_completed, but takes an iterator of futures as input, and includes support for max_jobs and max_load parameters.
- Parameters
futures (iterator) – iterator of asyncio.Future (or compatible)
max_jobs (int) – max number of futures to process concurrently (default is portage.util.cpuinfo.get_cpu_count())
max_load (int or float) – max load allowed when scheduling a new future, otherwise schedule no more than 1 future at a time (default is portage.util.cpuinfo.get_cpu_count())
loop (EventLoop) – event loop
- Returns
iterator of futures that are done
- Return type
iterator
- portage.util.futures.iter_completed.iter_gather(futures, max_jobs=None, max_load=None, loop=None)¶
This is similar to asyncio.gather, but takes an iterator of futures as input, and includes support for max_jobs and max_load parameters.
- Parameters
futures (iterator) – iterator of asyncio.Future (or compatible)
max_jobs (int) – max number of futures to process concurrently (default is portage.util.cpuinfo.get_cpu_count())
max_load (int or float) – max load allowed when scheduling a new future, otherwise schedule no more than 1 future at a time (default is portage.util.cpuinfo.get_cpu_count())
loop (EventLoop) – event loop
- Returns
a Future resulting in a list of done input futures, in the same order that they were yielded from the input iterator
- Return type
asyncio.Future (or compatible)