{ "info": { "author": "Fabian Neumann, ferret go GmbH", "author_email": "neumann@ferret-go.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Internet" ], "description": "==============\nsaferedisqueue\n==============\n\nA small wrapper around `Redis `_ (using the \"standard\"\n`Python redis client lib `_) that provides\naccess to a FIFO queue and allows upstream code to mark pop'ed items as\nprocessed successfully (ACK'ing) or unsucessfully (FAIL'ing).\n\nFailed items are automatically requeued. Addionally a backup is kept for items\nthat were neither ack'ed nor fail'ed, i.e. in case the consumer crashes. The\nbackup items will be requeued as soon as one of the consumer(s) comes up\nagain.\n\nAll actions are atomic and it is safe to have multiple producers and consumers\naccessing the same queue concurrently.\n\n\nVersion compatibility with redis.py\n------------------------------------\n\n=============== ===============\nredis.py saferedisqueue\n=============== ===============\n2.4.10 - 2.6.x 1.x\n2.7.0 - 2.7.5 no compatible version\n2.7.6 - 2.10.x 2.x-3.x\n=============== ===============\n\n\nUsage as a library\n==================\n\n>>> queue = SafeRedisQueue(name='test')\n>>> queue.put(\"Hello World\")\n'595d43b2-2e49-4e96-a1d2-0848d1c7f0d3'\n>>> queue.put(\"Foo bar\")\n'1df060eb-b578-499d-bede-20db9da8184e'\n>>> queue.get()\n('595d43b2-2e49-4e96-a1d2-0848d1c7f0d3', 'Hello World')\n>>> queue.get()\n('1df060eb-b578-499d-bede-20db9da8184e', 'Foo bar')\n\nNote: to be compatible with previous versions, 2 aliases ``push/pop`` exist. Start using the new ``put/get`` terminology as soon as possible since ``push/pop`` will be deleted in a future version.\n\n\nACK'ing and FAIL'ing\n--------------------\n\n>>> queue.put(\"Good stuff\")\n>>> queue.put(\"Bad stuff\")\n>>> uid_good, payload_good = queue.get()\n>>> uid_bad, payload_bad = queue.get()\n...\n# process the payloads...\n...\n>>> queue.ack(uid_good) # done with that one\n>>> queue.fail(uid_bad) # something didn't work out with that one, let's requeue\n>>> uid, payload = queue.get() # get again; we get the requeued payload again\n>>> uid == uid_bad\nTrue\n...\n# try again\n...\n>>> queue.ack(uid) # now it worked; ACK the stuff now\n\n\nget timeout\n-----------\n\n`SafeRedisQueue.get` accepts a timeout parameter:\n\n- 0 (the default) blocks forever, waiting for items\n- a positive number blocks that amount of seconds\n- a negative timeout disables blocking\n\n\nConstructor parameters\n----------------------\n\n`SafeRedisQueue` accepts ``*args, **kwargs`` and passes them to\n`redis.StrictRedis`, so use whatever you need.\n\n*Three exceptions*, use these in the keyword arguments to configure\n`SafeRedisQueue` itself:\n\n`url`\n Shortcut to use instead of a host/port/db/password combinations.\n Accepts \"redis URLs\" just as the redis library does, for example:\n\n - redis://[:password]@localhost:6379/0\n - unix://[:password]@/path/to/socket.sock?db=0\n\n When using this keyword parameter, all positional arguments (usually\n one the host) are ignored. Those two are equivalent:\n\n - ``SafeRedisQueue('localhost', port=6379, db=7)``\n - ``SafeRedisQueue(url='redis://localhost:6379/7')``\n\n`name`\n A prefix used for the keys in Redis. Default: \"0\", which creates the\n following keys in your Redis DB:\n\n - srq:0:items\n - srq:0:queue\n - srq:0:ackbuf\n - srq:0:backup\n - srq:0:backuplock\n\n`autoclean_interval`\n An interval in seconds (default: 60) at which *unacknowledged* items are\n requeued automatically. (They are moved from the internal ackbuf and backup data\n structures to the queue again.)\n\n Pass ``None`` to disable autocleaning. It's enabled by default!\n\n`serializer`\n An optional serializer to use on the items. Default: None\n\n Feel free to write your own serializer. It only requires a ``dumps``\n and ``loads`` methods. Modules like ``pickle``, ``json``,\n ``simplejson`` can be used out of the box.\n\n Note however, that when using Python 3 the ``json`` module has to be\n wrapped as it by default does not handle the ``bytes`` properly that\n is emitted by the underlying redis.py networking code. This should\n work::\n\n class MyJSONSerializer(object):\n @staticmethod\n def loads(bytes):\n return json.loads(bytes.decode('utf-8'))\n\n @staticmethod\n def dumps(data):\n return json.dumps(data)\n\n queue = SafeRedisQueue(name='foobar',serializer=MyJSONSerializer)\n\n *Added in version 3.0.0*\n\n\nCommand line usage\n==================\n\nFor quick'n'dirty testing, you can use the script from the command line to put stuff into the queue::\n\n $ echo \"Hello World\" | python saferedisqueue.py producer\n\n...and get it out again::\n\n $ python saferedisqueue.py consumer\n cbdabbc8-1c0f-4eb0-8733-fdb62a9c0fa6 Hello World\n\n\n=======\nChanges\n=======\n\n3.0.0 - 2014-11-13\n------------------\n\n- BREAKING CHANGE (very unlikely, though): `push`/`put` now returns the\n uid of the just added item. Before it always returned `None`.\n- `push` has been renamed to `put`; `push` stays as an alias, but is\n deprecated and will be removed in version 4.\n- `pop` has been renamed to `get`; `pop` stays as an alias, but is\n deprecated and will be removed in version 4.\n- Increased version compatibility with redis.py to \"<2.11\".\n- Python 3.4 support\n- More tests. Introduced tox for testing.\n- Added `serializer` parameter to support custom serializers,\n e.g. for automatic JSON conversion. See README for details, especially\n when using Python 3.\n\n\n2.0.0 - 2014-06-26\n------------------\n\n- SafeRedisQueue is now officially compatible with recent versions\n (roughly speaking 2.7-2.10) of redis.py.\n\n For versions 2.4 and 2.6 please continue using the 1.x development\n line.\n\n See README.rst for details on compatibility.\n\n\n1.2.0 - 2014-06-26\n------------------\n\n- Raise compatible redis.py version up to 2.6.x. Updated README with\n compatibility details.\n\n\n\n1.1.0 - 2014-06-20\n------------------\n\n- The constructor now accepts a \"url\" keyword parameter that supports\n typical redis URL a la \"redis://[:password]@localhost:6379/0\". See\n README for details.\n\n\n1.0.1 - 2013-06-26\n------------------\n\n- Changed dependency on redis to require at least version 2.4.10 as\n redis.StrictRedis, which we use, was only introduced in that version.\n This should not affect anyone negatively as you wouldn't have to be able\n to use saferedisqueue at all if your project or package used an older\n version so far.\n (Thanks Telofy!)\n\n\n1.0.0 - 2013-06-05\n------------------\n\n- Released as open-source under 3-clause BSD license. Code identical to 0.3.0.\n\n\n0.3.0 - 2012-05-22\n------------------\n\n- The constructor now accepts an \"autoclean_interval\" value to set the interval\n at which the ackbuf -> backup rotation and backup requeuing happens.\n Setting the value to `None` disables autoclean completely.\n Default: 60 (seconds).\n\n\n0.2.2 - 2012-03-29\n------------------\n\n- Negative timeout makes .pop() non-blocking.\n\n\n0.2.1 - 2012-03-09\n------------------\n\n- Added setup.py and publish it on our internal package directory.\n\n\n0.2.0 - 2012-03-08\n------------------\n\n- Renamed methods (\"push_item\" -> \"push\" etc.)\n- New autoclean method that is called on every .pop()\n- Internal: New names for keys in the redis db.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hellp/saferedisqueue", "keywords": "Redis,key-value store,queue,queueing,Storm", "license": "Copyright (c) 2013, Fabian Neumann, ferret go GmbH\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n * Neither the name of the ferret go GmbH nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": null, "maintainer_email": null, "name": "saferedisqueue", "package_url": "https://pypi.org/project/saferedisqueue/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/saferedisqueue/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hellp/saferedisqueue" }, "release_url": "https://pypi.org/project/saferedisqueue/3.0.0/", "requires_dist": null, "requires_python": null, "summary": "A small wrapper around Redis that provides access to a FIFO queue.", "version": "3.0.0" }, "last_serial": 1453948, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1b6e68e2b652fdfbbc0adf6f2648b968", "sha256": "6a12e76fd238b0875f6742ffc0d199d7ee43875259b308ec583665cefcfc1302" }, "downloads": -1, "filename": "saferedisqueue-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1b6e68e2b652fdfbbc0adf6f2648b968", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5417, "upload_time": "2013-06-05T14:57:48", "url": "https://files.pythonhosted.org/packages/4e/0f/254b78599005dbdce4414b783627c0214740c757c71cc6f409eac7bbfc32/saferedisqueue-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "72dd1262097f948579fe992eb7e9baa7", "sha256": "67a916f296608db0235008b854c655e414564db4b5c39753fbd6489840eaef71" }, "downloads": -1, "filename": "saferedisqueue-1.0.1.tar.gz", "has_sig": false, "md5_digest": "72dd1262097f948579fe992eb7e9baa7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5621, "upload_time": "2013-06-26T22:07:51", "url": "https://files.pythonhosted.org/packages/82/16/99aff89b3b3e3bc12b2f6b02df59c30f36c4ecd34a9fd85f514dbc2810ed/saferedisqueue-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "f249fbfb2ef8bf5bdfac926785c403a1", "sha256": "548c62b6c93f1be8649a858991c631ce8b31c97c8a8f412361929069fef6f28b" }, "downloads": -1, "filename": "saferedisqueue-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f249fbfb2ef8bf5bdfac926785c403a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6092, "upload_time": "2014-06-20T11:39:24", "url": "https://files.pythonhosted.org/packages/55/f4/8db1473e8ea465feb23a7a16e75e0ca55f20bf0c1406901afa09f5646f06/saferedisqueue-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "8fc4f134b2e4dc913c60335eacd52bf4", "sha256": "979fb73fef0070a14f4bfbb517f8c475e2429fd32dbcd79d2521cadf0924f054" }, "downloads": -1, "filename": "saferedisqueue-1.2.0.tar.gz", "has_sig": false, "md5_digest": "8fc4f134b2e4dc913c60335eacd52bf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6201, "upload_time": "2014-06-26T16:19:48", "url": "https://files.pythonhosted.org/packages/bc/47/82e34262b8548b90b942896aac11970bcf9366d2b1bad26ca76a5b4ad841/saferedisqueue-1.2.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "da0cb405ec99b54b10d7fde4297bba5d", "sha256": "530c49aabe237c82ef3bbb05dff4aeca39f6c3e8c49081aea23458ed288d9c9f" }, "downloads": -1, "filename": "saferedisqueue-2.0.0.tar.gz", "has_sig": false, "md5_digest": "da0cb405ec99b54b10d7fde4297bba5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6410, "upload_time": "2014-06-26T14:16:46", "url": "https://files.pythonhosted.org/packages/13/1d/9116448c9c1ce4a35ff1f2ccf33f5c95781bd0f6e10d35d3d7c55eeecd7f/saferedisqueue-2.0.0.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "4ba477690719a3b5fd905c29e108e96e", "sha256": "c9205b94707d1607584a1a0afc60e42f922ed2b5a1dda6eb249bb05f78b36573" }, "downloads": -1, "filename": "saferedisqueue-3.0.0.tar.gz", "has_sig": false, "md5_digest": "4ba477690719a3b5fd905c29e108e96e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7529, "upload_time": "2014-11-13T14:52:02", "url": "https://files.pythonhosted.org/packages/57/46/8608a8a839829bf16791c3058fa759dc6e121fdb23fa022a5641e909c2cc/saferedisqueue-3.0.0.tar.gz" } ], "4.0b0": [ { "comment_text": "", "digests": { "md5": "ee832b1b8de8228ddb7876514cedd6c1", "sha256": "10f42fce4ac1ac27209c4861f02f144467acfa4299c507142636495649fe0e24" }, "downloads": -1, "filename": "saferedisqueue-4.0b0.tar.gz", "has_sig": false, "md5_digest": "ee832b1b8de8228ddb7876514cedd6c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9455, "upload_time": "2015-03-09T11:41:14", "url": "https://files.pythonhosted.org/packages/79/3f/54dc4efed419cac0686ebdf911794c4dcdd2215111cca6bec47120e868f0/saferedisqueue-4.0b0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ba477690719a3b5fd905c29e108e96e", "sha256": "c9205b94707d1607584a1a0afc60e42f922ed2b5a1dda6eb249bb05f78b36573" }, "downloads": -1, "filename": "saferedisqueue-3.0.0.tar.gz", "has_sig": false, "md5_digest": "4ba477690719a3b5fd905c29e108e96e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7529, "upload_time": "2014-11-13T14:52:02", "url": "https://files.pythonhosted.org/packages/57/46/8608a8a839829bf16791c3058fa759dc6e121fdb23fa022a5641e909c2cc/saferedisqueue-3.0.0.tar.gz" } ] }