Title: Theory / Unimportant / CS / Programming / Python / Async / Queue
On every note of this deck, unless a note says otherwise:
Page: https://docs.python.org/3.10/library/asyncio-queue.html
Page: https://docs.python.org/3.10/library/asyncio-queue.html

Typ: asyncio.Queue()
Meaning: A first in, first out (FIFO) infinite queue of thread
Language: python
Context: subprocess

Typ: asyncio.Queue(maxsize)
Meaning: A FIFO of thread of size at most maxsize
Language: python
Context: subprocess

Typ: asyncio.PriorityQueue
Meaning: A priority queue of thread
Language: python
Context: subprocess

Typ: asyncio.LifoQueue
Meaning: A variant of asyncio.Queue that retrieves most recently added entries first (last in, first out).
Language: python
Context: subprocess

Typ: syncio.QueueEmpty
Meaning: exception is raised when the get_nowait() method is called on an empty queue.
Language: python
Context: subprocess

Typ: asyncio.QueueFull
Meaning: raised when the put_nowait() method is called on a queue that has reached its maxsize.
Language: python
Context: subprocess

Variable: asyncio_queue.maxsize
Meaning: Number of items allowed in the queue.
Page: https://docs.python.org/3.10/library/asyncio-queue.html
Language: python
Variables: asyncio_queue: asyncio.Queue

Instruction: asyncio_queue.empty()
Language: python
Returns: Whether the queue is empty
Variables: asyncio_queue: asyncio.Queue

Instruction: asyncio_queue.full()
Language: python
Returns: Whether the queue is full
Variables: asyncio_queue: asyncio.Queue

Instruction: asyncio_queue.get()
Language: python
Returns: Remove and return an item from the queue. If queue is empty, wait until an item is available.
Variables: asyncio_queue: asyncio.Queue

Instruction: asyncio_queue.get_nowait()
Language: python
Returns: an item if one is immediately available
Variables: asyncio_queue: asyncio.Queue
Exception: QueueEmpty if the queue is empty

Instruction: asyncio_queue.join()
Effect: Block until all items in the queue have been received and processed.
Language: python
Extra: The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer coroutine calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.

Instruction: asyncio_queue.put(item)
Effect: Put an item into the queue. If the queue is full, wait until a free slot is available before adding the item.
Language: python

Instruction: asyncio_queue.put_nowait(item)
Effect: Put an item into the queue without blocking.
Language: python
Extra: If no free slot is immediately available, raise QueueFull.

Instruction: asyncio_queue.qsize()
Language: python
Returns: the number of items in the queue.

Instruction: asyncio_queue.task_done()
Effect: Indicate that a formerly enqueued task is complete.
Language: python
Extra: Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.
If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).
Exception: Raises ValueError if called more times than there were items placed in the queue.

Instruction: loop
Page: https://docs.python.org/3.10/library/asyncio-eventloop.html
Effect: todo end it
Language: python