Skip to main content

Tarantool Queue bindings for work with python asyncio

Bindings require tarantool version 1.6 and aiotarantool connector:

$ pip install aiotarantool_queue aiotarantool

Try it example:

import asyncio
import aiotarantool_queue
import random

@asyncio.coroutine
def put_job(queue):
    for tube_name in ("tube1", "tube2", "tube3"):
        tube = queue.tube(tube_name)
        task = yield from tube.put({"task_data": random.random()})

@asyncio.coroutine
def take_job(tube):
    while True:
        task = yield from tube.take(5)
        if not task:
            break

        print(task.data)
        yield from task.ack()

loop = asyncio.get_event_loop()

queue = aiotarantool_queue.Queue("127.0.0.1", 3301)
put_tasks = [asyncio.async(put_job(queue))
             for _ in range(20)]

take_tasks = [asyncio.async(take_job(queue.tube(tube_name)))
              for tube_name in ("tube1", "tube2", "tube3")]

loop.run_until_complete(asyncio.wait(put_tasks + take_tasks))
loop.run_until_complete(queue.close())
loop.close()

This code makes it easy to develop your application to work with queue.

Metadata

Release files for aiotarantool_queue 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiotarantool_queue 0.0.3
File Size Uploaded
aiotarantool_queue-0.0.3.tar.gz 4.3 kB Details

Release files / aiotarantool_queue-0.0.3.tar.gz

Download URL aiotarantool_queue-0.0.3.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8f1d3f2a1996f585177885772639f1efcdb1f5430fde8cc476e55ab080ea9dcc
BLAKE2b-256 checksum
How to use checksums
3ca6e53b4e50a18c6e7309a062adb52359aadb4ec9bdb2f083d3c44bfc022e1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page