Lines Matching full:queue

10 :mod:`queue` module.  Although asyncio queues are not thread-safe,
14 use :func:`asyncio.wait_for` function to do queue operations with a
19 Queue chapter
22 .. class:: Queue(maxsize=0, \*, loop=None)
24 A first in, first out (FIFO) queue.
26 If *maxsize* is less than or equal to zero, the queue size is
28 ``await put()`` blocks when the queue reaches *maxsize*
31 Unlike the standard library threading :mod:`queue`, the size of
32 the queue is always known and can be returned by calling the
39 Number of items allowed in the queue.
43 Return ``True`` if the queue is empty, ``False`` otherwise.
47 Return ``True`` if there are :attr:`maxsize` items in the queue.
49 If the queue was initialized with ``maxsize=0`` (the default),
54 Remove and return an item from the queue. If queue is empty,
64 Block until all items in the queue have been received and processed.
67 to the queue. The count goes down whenever a consumer coroutine calls
74 Put an item into the queue. If the queue is full, wait until a
79 Put an item into the queue without blocking.
85 Return the number of items in the queue.
91 Used by queue consumers. For each :meth:`~Queue.get` used to
93 queue that the processing on the task is complete.
97 call was received for every item that had been :meth:`~Queue.put`
98 into the queue).
101 items placed in the queue.
104 Priority Queue
109 A variant of :class:`Queue`; retrieves entries in priority order
116 LIFO Queue
121 A variant of :class:`Queue` that retrieves most recently added
130 This exception is raised when the :meth:`~Queue.get_nowait` method
131 is called on an empty queue.
136 Exception raised when the :meth:`~Queue.put_nowait` method is called
137 on a queue that has reached its *maxsize*.
153 async def worker(name, queue):
155 # Get a "work item" out of the queue.
156 sleep_for = await queue.get()
161 # Notify the queue that the "work item" has been processed.
162 queue.task_done()
168 # Create a queue that we will use to store our "workload".
169 queue = asyncio.Queue()
171 # Generate random timings and put them into the queue.
176 queue.put_nowait(sleep_for)
178 # Create three worker tasks to process the queue concurrently.
181 task = asyncio.create_task(worker(f'worker-{i}', queue))
184 # Wait until the queue is fully processed.
186 await queue.join()