{ "info": { "author": "G. B. Versiani", "author_email": "guibv@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries" ], "description": "======\npqueue\n======\n\n**pqueue** is a simple persistent (disk-based) FIFO queue for Python.\n\n**pqueue** goals are speed and simplicity. The development was initially based\non the `Queuelib`_ code.\n\nRequirements\n============\n\n* Python 2.7 or Python 3.x\n* no external libraries requirements\n\nInstallation\n============\n\nYou can install **pqueue** either via Python Package Index (PyPI) or from\nsource.\n\nTo install using pip::\n\n $ pip install pqueue\n\nTo install using easy_install::\n\n $ easy_install pqueue\n\nIf you have downloaded a source tarball you can install it by running the\nfollowing (as root)::\n\n # python setup.py install\n\nHow to use\n==========\n\n**pqueue** provides a single FIFO queue implementation.\n\nHere is an example usage of the FIFO queue::\n\n >>> from pqueue import Queue\n >>> q = Queue(\"tmpqueue\")\n >>> q.put(b'a')\n >>> q.put(b'b')\n >>> q.put(b'c')\n >>> q.get()\n b'a'\n >>> del q\n >>> q = Queue(\"tmpqueue\")\n >>> q.get()\n b'b'\n >>> q.get()\n b'c'\n >>> q.get_nowait()\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"/usr/lib/python2.7/Queue.py\", line 190, in get_nowait\n return self.get(False)\n File \"/usr/lib/python2.7/Queue.py\", line 165, in get\n raise Empty\n Queue.Empty\n \nThe Queue object is identical to Python's 'Queue' module (or 'queue' in Python\n3.x), with the difference that it requires a parameter 'path' indicating where\nto persist the queue data and 'chunksize' indicating how many enqueued items\nshould be stored per file. The same 'maxsize' parameter available on the\nsystem wise 'Queue' has been maintained.\n\nIn other words, it works exactly as Python's Queue, with the difference any\nabrupt interruption is `ACID-guaranteed`_::\n\n q = Queue()\n\n def worker():\n while True:\n item = q.get()\n do_work(item)\n q.task_done()\n\n for i in range(num_worker_threads):\n t = Thread(target=worker)\n t.daemon = True\n t.start()\n\n for item in source():\n q.put(item)\n\n q.join() # block until all tasks are done\n\nNote that pqueue *is not intended to used by multiple processes*.\n\nHow it works?\n=============\n\nPushed data is serialized using pickle in sequence, on chunked files named as\nqNNNNN, with a maximum of 'chunksize' elements, all stored on the given 'path'.\n\nThe queue is formed by a 'head' and a 'tail'. Pushed data goes on 'head',\npulled data goes on 'tail'.\n\nAn 'info' file is pickled in the 'path', having the following 'dict':\n\n* 'head': a list of three integers, an index of the 'head' file, the number of\n elements written, and the file position of the last write.\n* 'tail': a list of three integers, an index of the 'tail' file, the number of\n elements read, and the file position of the last read.\n* 'size': number of elements in the queue.\n* 'chunksize': number of elements that should be stored in each disk queue\n file.\n\nBoth read and write operations depend on sequential transactions on disk. In\norder to accomplish ACID requirements, these modifications are protected by the\nQueue locks.\n\nIf, for any reason, the application stops working in the middle of a head\nwrite, a second execution will remove any inconsistency by truncating the\npartial head write.\n\nOn 'get', the 'info' file is not updated, only when you first call 'task_done',\nand only on the first time case you have to call it sequentially.\n\nThe 'info' file is updated in the following way: a temporary file (using\n'mkstemp') is created with the new data and then moved over the previous 'info'\nfile. This was designed this way as POSIX 'rename' is guaranteed to be atomic.\n\nIn case of abrupt interruptions, one of the following conditions may happen:\n\n* A partial write of the last pushed element may occur and in this case only\n this last element pushed will be discarded.\n* An element pulled from the queue may be processing, and in this case a second\n run will consume same element again.\n\nTests\n=====\n\nTests are located in **pqueue/tests** directory. They can be run using\nPython's default **unittest** module with the following command::\n\n ./runtests.py\n\nThe output should be something like the following::\n\n ./runtests.py\n test_GarbageOnHead (pqueue.tests.test_queue.PersistenceTest)\n Adds garbage to the queue head and let the internal integrity ... ok\n test_MultiThreaded (pqueue.tests.test_queue.PersistenceTest)\n Create consumer and producer threads, check parallelism ... ok\n test_OpenCloseOneHundred (pqueue.tests.test_queue.PersistenceTest)\n Write 1000 items, close, reopen checking if all items are there ... ok\n test_OpenCloseSingle (pqueue.tests.test_queue.PersistenceTest)\n Write 1 item, close, reopen checking if same item is there ... ok\n test_PartialWrite (pqueue.tests.test_queue.PersistenceTest)\n Test recovery from previous crash w/ partial write ... ok\n test_RandomReadWrite (pqueue.tests.test_queue.PersistenceTest)\n Test random read/write ... ok\n \n ----------------------------------------------------------------------\n Ran 6 tests in 1.301s\n \n OK\n\nLicense\n=======\n\nThis software is licensed under the BSD License. See the LICENSE file in the\ntop distribution directory for the full license text.\n\nVersioning\n==========\n\nThis software follows `Semantic Versioning`_\n\n.. _Queuelib: http://github.com/scrapy/queuelib\n.. _ACID-guaranteed: http://en.wikipedia.org/wiki/ACID\n.. _Semantic Versioning: http://semver.org/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/balena/python-pqueue", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pqueue", "package_url": "https://pypi.org/project/pqueue/", "platform": "all", "project_url": "https://pypi.org/project/pqueue/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/balena/python-pqueue" }, "release_url": "https://pypi.org/project/pqueue/0.1.7/", "requires_dist": null, "requires_python": null, "summary": "A single process, persistent multi-producer, multi-consumer queue.", "version": "0.1.7" }, "last_serial": 2689708, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "f9b6b481975e1f0467a132596ed3e710", "sha256": "26b2b60e6336f9b9081733f7aec5daf1ab2214ab3e987dd7dbaf2d2042911a07" }, "downloads": -1, "filename": "pqueue-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f9b6b481975e1f0467a132596ed3e710", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5839, "upload_time": "2015-09-14T18:21:35", "url": "https://files.pythonhosted.org/packages/f7/0b/44d45e992853bb156e80a07504b7996f66f848f703c86a3965f959377234/pqueue-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0246ff9c3e02178d256018025f2abb61", "sha256": "f06894a50d1807f6873b3f87cda7428cb85d7602d5fa1786ac793bd36b99c217" }, "downloads": -1, "filename": "pqueue-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0246ff9c3e02178d256018025f2abb61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5974, "upload_time": "2015-12-22T14:28:07", "url": "https://files.pythonhosted.org/packages/62/51/05fe49de1c85a738775b9e81aa2b460525ba501bebcb979f35c2482d9c26/pqueue-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c907531589644398c60e92346635644c", "sha256": "83f8a2f81f6ad8f5332ae139c419fa8751cc575f5f413a2fa01000d97a93beea" }, "downloads": -1, "filename": "pqueue-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c907531589644398c60e92346635644c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6130, "upload_time": "2016-07-04T11:43:04", "url": "https://files.pythonhosted.org/packages/d8/f1/15adfe648c5fabe8baf292c2a202ca141bbaf26209fe8ec1ea452da75082/pqueue-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "05fb1115d9be8b6375cbc0538d9f862b", "sha256": "341d2e152529071440f00a5942f464f6f0f1be65a1dd5c1b3ff7aeeeb4f77793" }, "downloads": -1, "filename": "pqueue-0.1.4.tar.gz", "has_sig": false, "md5_digest": "05fb1115d9be8b6375cbc0538d9f862b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6096, "upload_time": "2016-11-14T11:11:00", "url": "https://files.pythonhosted.org/packages/ff/07/3001da2caaf7473ac71efb77887fc70b0ae79cf03cd8eba7a650e2740a99/pqueue-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "873706da2083fc9881804177ed27e8f7", "sha256": "b717f4b978455a7c79747348db0b8d5b3a73ec0778cb5f01acde0bab2751abbe" }, "downloads": -1, "filename": "pqueue-0.1.5.tar.gz", "has_sig": false, "md5_digest": "873706da2083fc9881804177ed27e8f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6103, "upload_time": "2016-11-14T11:39:40", "url": "https://files.pythonhosted.org/packages/d0/2f/53d1b353d050f15ed6234517b2257482be71bae53c51b83332d036dcd038/pqueue-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "5dd58ecabf40a9acc7e4c200e82bf71f", "sha256": "873f0893f299d8773a2df8db4d0ab1741d5e0da5873d7862964aeb92d249cd3c" }, "downloads": -1, "filename": "pqueue-0.1.6.tar.gz", "has_sig": false, "md5_digest": "5dd58ecabf40a9acc7e4c200e82bf71f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6125, "upload_time": "2016-11-14T11:59:52", "url": "https://files.pythonhosted.org/packages/3b/a5/9fc58822da56e61d7a8a0ec6819807eee93ac65353e919d73d2bc44415ff/pqueue-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "1845d7f2c0eade4eb3b94c9e1713622c", "sha256": "e843fcc2676f306938784014953178c946ade4369696ce6300774684ba885be1" }, "downloads": -1, "filename": "pqueue-0.1.7.tar.gz", "has_sig": false, "md5_digest": "1845d7f2c0eade4eb3b94c9e1713622c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6256, "upload_time": "2017-03-07T20:11:06", "url": "https://files.pythonhosted.org/packages/40/80/30cc93b4a37d372e3b0fe241fb056e29f7cf09b260c94ac52dc5cdc1b5ed/pqueue-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1845d7f2c0eade4eb3b94c9e1713622c", "sha256": "e843fcc2676f306938784014953178c946ade4369696ce6300774684ba885be1" }, "downloads": -1, "filename": "pqueue-0.1.7.tar.gz", "has_sig": false, "md5_digest": "1845d7f2c0eade4eb3b94c9e1713622c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6256, "upload_time": "2017-03-07T20:11:06", "url": "https://files.pythonhosted.org/packages/40/80/30cc93b4a37d372e3b0fe241fb056e29f7cf09b260c94ac52dc5cdc1b5ed/pqueue-0.1.7.tar.gz" } ] }