An utility for asyncio.Queue.
Project description
wcpan.queue
An utility for asyncio.Queue
.
from wcpan.queue import AioQueue
async def task(): ...
async def amain():
# Creates a priority queue.
# Use AioQueue.fifo() for FIFO and AioQueue.lifo() for LIFO.
with AioQueue.priority() as queue:
# Push a task which priority is 1, lesser number has higher priority.
# Default is 0.
# Priority is ignored for FIFO and LIFO queues.
await queue.push(task(), 1)
# Spawns 8 consumers to consume the queue.
# Default is 1.
await queue.consume(8)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wcpan_queue-7.0.0.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for wcpan_queue-7.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7756fc392d6068e12d2dce83980703e720f3de259fb32abbb5d2c2df23cc61db |
|
MD5 | 4955a056675ec230e6244b5ce3b90666 |
|
BLAKE2b-256 | eafd35a05d3ddb84e6a4d1da618b769ab36c56d5057e6a530e33593ad5db166b |