nemoguardrails.guardrails.async_work_queue
nemoguardrails.guardrails.async_work_queue
Module Contents
Classes
Data
API
Bases: Generic[T]
Async Work Queue with static concurrency and queue size
Context manager (used for testing rather than long-lived instance)
Context manager (used for testing rather than long-lived instance)
Returns True if any worker is currently executing a task.
Returns True if the queue has zero pending items.
Returns True if the queue is currently full.
Returns the number of workers currently executing a task.
Number of items buffered in the queue, waiting for a worker.
Pairs with :meth:num_busy_workers — together they cover the two states a
WorkItem can be in.
Starts the worker pool. Call this during service startup.
Stops the worker pool. Call this during service shutdown.
Submit a task. If queue is full:
- self._reject_on_full=True -> Raises asyncio.QueueFull
- self._reject_on_full=False -> Blocks caller until slot opens
Note: Automatically starts the queue on first submission (lazy initialization).
Bases: Generic[T]
Dataclass with async function, args, kwargs, and a future to return result