simple_queue

Simplified queues

class SimpleToroQueue(io_loop=None)[source]

Bases: object

Simplified Toro queue without size limit

empty()[source]

Return True if the queue is empty, False otherwise

get_all()[source]

Remove ans return all items from the queue, without blocking

get_nowait()[source]

Remove and return an item from the queue without blocking.

Return an item if one is immediately available, else raise queue.Empty.

get_wait(deadline=None)[source]

Remove and return an item from the queue. Returns a Future.

The Future blocks until an item is available, or raises toro.Timeout.

Parameters:deadline – Optional timeout, either an absolute timestamp (as returned by io_loop.time()) or a

datetime.timedelta for a deadline relative to the current time.

put(item)[source]

Put an item into the queue (without waiting)

Parameters:item – item to add
qsize()[source]

Return number of items in the queue

class ThreadSafeQueue[source]

Bases: object

Simplified thread-safe/coroutine queue, without size limit

get()[source]

Pop one item from the queue, without waiting

get_all()[source]

Pop all items from the queue, without waiting

get_wait(deadline=None)[source]

Wait for an available item and pop it from the queue

Parameters:deadline – optional deadline
put(item)[source]

Put an item on the queue

Parameters:item – item
TimeoutTask(func, deadline=None, *args, **kwargs)[source]

Encapsulate a Tornado Task with a deadline