Async Queue¶
asyncio.Queue subclass
While useful, you might want to consider the cli2.tasks module
instead.
- class cli2.queue.Queue(*args, num_workers=None, **kwargs)[source]¶
An async queue with worker pool for concurrent task processing.
Extends asyncio.Queue to manage a pool of worker tasks that process items from the queue concurrently.
# will run 2 at the time queue = cli2.Queue(num_workers=2) # call like asyncio.run await queue.run(foo(), bar(), other())
- num_workers¶
Number of concurrent workers (default: cpucount * 2)
- results¶
List of results from completed tasks, order of results not garanteed due to concurrency.