ray.util.queue.Queue.get#
- Queue.get(block: bool = True, timeout: float | None = None) Any[source]#
Gets an item from the queue.
If block is True and the queue is empty, blocks until the queue is no longer empty or until timeout.
There is no guarantee of order if multiple consumers get from the same empty queue.
- Parameters:
block – If True, wait up to
timeoutfor an item to become available. If False, raiseEmptyimmediately when the queue is empty.timeout – Maximum number of seconds to wait when
blockis True.Nonewaits forever.
- Returns:
The next item in the queue.
- Raises:
Empty – if the queue is empty and blocking is False.
Empty – if the queue is empty, blocking is True, and it timed out.
ValueError – if timeout is negative.