Skip to main content

Tarantool Queue python/asyncio bindings

Project description

Build Status Coverage Status PyPI

asynctnt-queue is a python/asyncio bindings library for tarantool-queue package in Tarantool Database, integrated with asynctnt module.

Documentation

Documentation is available here.

Installation

Use pip to install:

$ pip install asynctnt-queue

Basic Usage

Tarantool config:

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:

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

  1. Tarantool - in-memory database and application server.

  2. asynctnt - fast Tarantool database connector for Python/asyncio

  3. aiotarantool - alternative Python/asyncio connector

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asynctnt-queue-0.0.5.tar.gz (11.5 kB view details)

Uploaded Source

File details

Details for the file asynctnt-queue-0.0.5.tar.gz.

File metadata

File hashes

Hashes for asynctnt-queue-0.0.5.tar.gz
Algorithm Hash digest
SHA256 052ce40e031d1e8549242d11c7bd9dd8e84a43cdbb58efcc2bbf9c1fe5e84de5
MD5 1347f72fe28a40a84ee4d13d7ee514dc
BLAKE2b-256 d4cc578937f323d3950ad758008c123a7d35c3c23de0116e4de6e78cecad0fa4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page