You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

asynctnt-queue

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asynctnt-queue

Tarantool Queue python/asyncio bindings

0.0.5
pipPyPI
Maintainers
1

asynctnt-queue

|Build Status| |Coverage Status| |PyPI|

asynctnt-queue is a python/asyncio bindings library for tarantool-queue <https://github.com/tarantool/queue>__ package in Tarantool Database <https://tarantool.org/>, integrated with asynctnt <https://github.com/igorcoding/asynctnt> module.

Documentation

Documentation is available here <https://igorcoding.github.io/asynctnt-queue>__.

Installation

Use pip to install:

.. code:: bash

$ pip install asynctnt-queue

Basic Usage

Tarantool config:

.. code:: lua

box.cfg {
    listen = '127.0.0.1:3301'
}

box.once('v1', function()
    box.schema.user.grant('guest', 'read,write,execute', 'universe')
end)

queue = require('queue')
queue.create_tube('test_tube', 'fifottl')

Python code:

.. code:: python

import asyncio
import asynctnt
import asynctnt_queue


async def run():
    conn = asynctnt.Connection(host='127.0.0.1', port=3301)
    await conn.connect()
    
    queue = asynctnt_queue.Queue(conn)
    test_tube = queue.tube('test_tube')
    
    # Add a task to queue
    task = await test_tube.put({
        'key': 'value'
    })
    
    print('Task id: {}'.format(task.task_id))
    print('Task status: {}'.format(task.status))
    
    # Retrieve a task from queue
    task = await test_tube.take(1)
    
    # ... do some work with task
    
    await task.ack()
    await conn.disconnect()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

References

  • Tarantool <https://tarantool.org>__ - in-memory database and application server.
  • asynctnt <https://github.com/igorcoding/asynctnt>__ - fast Tarantool database connector for Python/asyncio
  • aiotarantool <https://github.com/shveenkov/aiotarantool>__ - alternative Python/asyncio connector

.. |Build Status| image:: https://travis-ci.org/igorcoding/asynctnt-queue.svg?branch=master :target: https://travis-ci.org/igorcoding/asynctnt-queue .. |Coverage Status| image:: https://coveralls.io/repos/github/igorcoding/asynctnt-queue/badge.svg?branch=master :target: https://coveralls.io/github/igorcoding/asynctnt-queue?branch=master .. |PyPI| image:: https://img.shields.io/pypi/v/asynctnt-queue.svg :target: https://pypi.python.org/pypi/asynctnt-queue

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts