API Reference

Queue

class asynctnt_queue.Queue(conn: asynctnt.connection.Connection, tube_cls=<class 'asynctnt_queue.tube.Tube'>, namespace='queue')[source]
__init__(conn: asynctnt.connection.Connection, tube_cls=<class 'asynctnt_queue.tube.Tube'>, namespace='queue')[source]

Queue constructor.

Parameters:
  • conn – asynctnt connection (see asynctnt documentation)
  • tube_cls – Tube class that is used for Tube creation (default is asynctnt_queue.Tube)
  • namespace – Variable which was used for queue module import ( default is queue)
conn

asynctnt connection

Returns:asynctnt.Connection instance
namespace

Queues namespace

Returns:str instance
coroutine statistics(tube_name=None)[source]

Returns queue statistics (coroutine)

Parameters:tube_name – If specified, statistics by a specific tube is returned, else statistics about all tubes is returned
tube(name)[source]

Returns tube by its name

Parameters:name – Tube name
Returns:self.tube_cls instance (by default asynctnt_queue.Tube)

Tube

class asynctnt_queue.Tube(queue, name)[source]
coroutine ack(task_id)[source]

Ack task

Parameters:task_id – Task id
Returns:Task instance
coroutine bury(task_id)[source]

Buries (disables) task

Parameters:task_id – Task id
Returns:Task instance
conn

Returns corresponding connection object

Returns:asynctnt.Connection instance
coroutine delete(task_id)[source]

Deletes task from queue

Parameters:task_id – Task id
Returns:Task instance
coroutine kick(count)[source]

Kick count tasks from queue

Parameters:count – Tasks count to kick
Returns:Number of tasks actually kicked
name

Tube name

coroutine peek(task_id)[source]

Get task without changing its state

Parameters:task_id – Task id
Returns:Task instance
coroutine put(data, *, pri=None, ttl=None, ttr=None, delay=None)[source]

Puts data to the queue and returns a newly created Task

Parameters:
  • data – Arbitrary task payload
  • pri – Task priority (0 by default)
  • ttl – Task time-to-live
  • ttr – Task time-to-run
  • delay – Task delay
Returns:

Task instance

queue

Returns corresponding queue object

Returns:asynctnt_queue.Queue instance
coroutine release(task_id, *, delay=None)[source]

Release task (return to queue) with delay if specified

Parameters:
  • task_id – Task id
  • delay – Time in seconds before task will become ready again
Returns:

Task instance

statistics()[source]

Return tube’s statistics (identical to queue.statistics(tube_name))

Returns:Tube’s statistics
coroutine take(timeout=None)[source]

Takes task from the queue, waiting the timeout if specified

Parameters:timeout – Seconds to wait for ready tasks
Returns:Task instance
coroutine touch(task_id, increment)[source]

Update task ttl and/or ttr by increment value

Parameters:
  • task_id – Task id
  • increment – Seconds to add to ttr
Returns:

Task instance

Task

class asynctnt_queue.Task(tube, tnt_tuple)[source]
coroutine ack()[source]

Ack task

Returns:Task instance
coroutine bury()[source]

Buries (disables) task

Returns:Task instance
data

Task data

coroutine delete()[source]

Deletes task from queue

Returns:Task instance
coroutine peek()[source]

Get task without changing its state

Returns:Task instance
coroutine release(*, delay=None)[source]

Release task (return to queue) with delay if specified

Parameters:delay – Time in seconds before task will become ready again
Returns:Task instance
status

Task status

Returns:asynctnt_queue.Status instance
task_id

Task id

coroutine touch(increment)[source]

Update task ttl and/or ttr by increment value

Parameters:increment – Seconds to add to ttr
Returns:Task instance
tube

Task’s tube

Exceptions

class asynctnt_queue.exceptions.QueueError[source]

Base QueueError exception

class asynctnt_queue.exceptions.TaskEmptyError[source]

Raised when Tarantool responds with empty body for task