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
connectionReturns: 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 defaultasynctnt_queue.Tube
)
-
Tube¶
-
class
asynctnt_queue.
Tube
(queue, name)[source]¶ -
-
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
Task¶
-
class
asynctnt_queue.
Task
(tube, tnt_tuple)[source]¶ -
-
data
¶ Task data
-
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
-