Giter Club home page Giter Club logo

queue-python's Introduction

queue-python

Python Bindings for Tarantool Queue.

Library depends on:

  • msgpack-python
  • tarantool

Basic usage can be found in tests. Description on every command is in source code.

Big thanks to Dmitriy Shveenkov and Alexandr (FZambia) Emelin.

For install of latest "stable" version type:

# using pip
$ sudo pip install tarantool-queue
# or using easy_install
$ sudo easy_install tarantool-queue
# or using python
$ wget http://bit.ly/tarantool_queue -O tarantool_queue.tar.gz
$ tar xzf tarantool_queue.tar.gz
$ cd tarantool-queue-{version}
$ sudo python setup.py install

For install bleeding edge type:

$ sudo pip install git+https://github.com/tarantool/queue-python.git

For configuring Queue in Tarantool read manual Here.

Then just import it, create Queue, create Tube, put and take some elements:

>>> from tarantool_queue import Queue
>>> queue = Queue("localhost", 33013, 0)
>>> tube = queue.tube("name_of_tube")
>>> tube.put([1, 2, 3])
Not taken task instance
>>> task = tube.take()
>>> task.data # take task and read data from it
[1, 2, 3]
>>> task.ack() # move this task into state DONE
True

That's all, folks!

See Also

queue-python's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

queue-python's Issues

ER_INVALID_MSGPACK: Invalid MsgPack - packet header

Hi,

Error occurred during execution of the following code from the README file, using following environment:
Please check, any help would be appreciated.

Error:
iproto xrow.c:141 E> ER_INVALID_MSGPACK: Invalid MsgPack - packet header

Code
from tarantool_queue import Queue
queue = Queue("localhost", 3301, 0)
tube = queue.tube("q1")
tube.put([1, 2, 3])
task = tube.take()
task.ack()

Environment

  1. Ubuntu 18.04.5 LTS (Bionic Beaver)
  2. Tarantool 2.6.2-0-g34d504d7d
  3. Python 2.7.17
  4. Queue-python, v 0.1.4

Thanks in advance.

Install error

tarantool-queue package requires msgpack to be installed.

(tnt-queue-msgpack)[e.iskandarov@win91 ~]$ pip install tarantool-queue
Downloading/unpacking tarantool-queue
  Using download cache from /home/e.iskandarov/.cache/pip/http%3A%2F%2Fpypi.mail.ru%2Froot%2Fpypi%2Ff%2Fhttps%2Fpypi.python.org%2Fpackages%2Fsource%2Ft%2Ftarantool-queue%2Ftarantool-queue-0.1.1.zip
  Running setup.py egg_info for package tarantool-queue
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/home/e.iskandarov/.virtualenvs/tnt-queue-msgpack/build/tarantool-queue/setup.py", line 6, in <module>
        from tarantool_queue import __version__
      File "tarantool_queue/__init__.py", line 3, in <module>
        from tarantool_queue import Task, Tube, Queue
      File "tarantool_queue/tarantool_queue.py", line 4, in <module>
        import msgpack
    ImportError: No module named msgpack
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/home/e.iskandarov/.virtualenvs/tnt-queue-msgpack/build/tarantool-queue/setup.py", line 6, in <module>

    from tarantool_queue import __version__

  File "tarantool_queue/__init__.py", line 3, in <module>

    from tarantool_queue import Task, Tube, Queue

  File "tarantool_queue/tarantool_queue.py", line 4, in <module>

    import msgpack

ImportError: No module named msgpack

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/e.iskandarov/.virtualenvs/tnt-queue-msgpack/build/tarantool-queue
Storing complete log in /home/e.iskandarov/.pip/pip.log

Add tarantool-queue-python to Tarantool buildbot

  • Write RPM specs/DEB rules and push they to the repository. Please use package name that confirms official distributive naming conventions (e.g. tarantool-python-queue or python-tarantool-queue)
  • Add this project to build bot (http://build.tarantool.org/)
  • Check that module build and can be installed from tarantool.org repository

Исключение при попытке записать большой объем данных в очередь

Пример кода для воспроизведения проблемы

from tarantool_queue import Queue

queue = Queue("localhost", 33013, 0)
tube = queue.tube("name_of_tube")
tube.put({'x': 'x' * 10000000})

Получаем ошибку:

Traceback (most recent call last):
  File "ex.py", line 6, in <module>
    tube.put({'x': 'x' * 10000000})
  File "/usr/local/lib/python2.7/site-packages/tarantool_queue/tarantool_queue.py", line 260, in put
    self.serialize(data))
  File "/usr/local/lib/python2.7/site-packages/tarantool/connection.py", line 283, in call
    default_type=default_type)
  File "/usr/local/lib/python2.7/site-packages/tarantool/connection.py", line 236, in _send_request
    request, space_name, field_defs, default_type)
  File "/usr/local/lib/python2.7/site-packages/tarantool/connection.py", line 175, in _send_request_wo_reconnect
    self, header, body, space_name, field_defs, default_type)
  File "/usr/local/lib/python2.7/site-packages/tarantool/response.py", line 138, in __init__
    self._unpack_body(body)
  File "/usr/local/lib/python2.7/site-packages/tarantool/response.py", line 237, in _unpack_body
    "<%ds" % (tuple_size), buff, offset + 4)[0]
struct.error: unpack_from requires a buffer of at least 1948279913 bytes

Хотелось бы, чтобы записи подобного размера поддерживались. Была реальная проблема на бою.

Версии библиотек:

tarantool==0.3.6
tarantool-queue==0.1.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.