{ "info": { "author": "William Glass", "author_email": "william.glass@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Rotterdam\r\n=========\r\n\r\n.. image::\r\n https://travis-ci.org/wglass/rotterdam.svg?branch=master\r\n :alt: Build Status\r\n :target: https://travis-ci.org/wglass/rotterdam\r\n.. image::\r\n https://codeclimate.com/github/wglass/rotterdam/badges/gpa.svg\r\n :alt: Code Climate\r\n :target: https://codeclimate.com/github/wglass/rotterdam\r\n\r\nRotterdam is an asynchronous job queue system written in Python with a dab\r\nof Lua, designed with simplicty and ease of use in mind with as few\r\ndependencies as possible.\r\n\r\n\r\nIt uses Redis_ as its datastore and is heavily inspired by the Unicorn_ and\r\nGunicorn_ master/worker process model.\r\n\r\n.. contents:: :local:\r\n\r\n\r\nInstallation\r\n------------\r\n\r\nRotterdam is available via pypi, installing for clients is as easy as::\r\n\r\n pip install rotterdam\r\n\r\nTo use the server scripts, install the \"server\" subproject::\r\n\r\n pip install rotterdam[server]\r\n\r\nUsage\r\n-----\r\n\r\nMake sure to have a redis instance version 2.6 or newer at the location\r\nspecified in your config file under the ``arbiter`` section. See the\r\nexample.cfg file for an example.\r\n\r\nStarting up\r\n~~~~~~~~~~~\r\nTo start the rotterdam server, run the ``rotterdam`` executable and pass in\r\nthe location of a config file (an example.cfg is included in this here repo)::\r\n\r\n [ ~ ] $ rotterdam example.cfg\r\n INFO:rotterdam.master:Starting master (52174)\r\n INFO:rotterdam.master:Listening on port 8765\r\n INFO:rotterdam.master:Starting up consumer\r\n INFO:rotterdam.master:Starting up consumer\r\n\r\nSending jobs\r\n~~~~~~~~~~~~\r\nAll a client program has to do is instantiate a ``Rotterdam`` class with the\r\nproper host and port and call ``enqueue``::\r\n\r\n from rotterdam import Rotterdam\r\n\r\n client = Rotterdam(\"localhost\") # default port is 8765\r\n\r\n client.enqueue(\"rotterdam.example:some_job\", \"thingy\", \"guy\", foo=\"bar\")\r\n client.enqueue(\"rotterdam.example:some_job\", \"derp\", \"hork\", foo=\"bazz\")\r\n\r\nThe first argument to ``enqueue`` can either be an instance of a function, or a\r\nstring with the full namespace of the function to be run.\r\n\r\nIn this example, the job is a simple function that prints out its own\r\narguments::\r\n\r\n import time\r\n\r\n def some_job(arg1, arg2, foo=None):\r\n time.sleep(2)\r\n print \"arg1: %s\" % arg1\r\n print \"arg2: %s\" % arg2\r\n print \"foo: %s\" % foo\r\n\r\nSo once the client program is run the rotterdam process will print out the args\r\non its end::\r\n\r\n arg1: derp\r\n arg2: hork\r\n foo: bazz\r\n arg1: thingy\r\n arg2: guy\r\n foo: bar\r\n\r\nNote that since it's jobs are executed _concurrently_ with consumer processes\r\nthey don't necessarily execute in the same order the client sends them.\r\n\r\nControlling the master process\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nRotterdam uses inter-process communcation (IPC) signals for most tasks so that\r\nthe master/worker processes can chug along the whole time without needed to\r\nbe restarted. The ``rotterdamctl`` program is a handy utility for sending\r\nthe proper signals to the proper process. This program also takes the location\r\nof a config file as the first argument. Make sure to use the same config file\r\nas the rotterdam process you want to control!\r\n\r\nControlling the number of consumers\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nTo add a consumer to the existing rotterdam processes, pass the ``expand``\r\ncommand to ``rotterdamctl``.::\r\n\r\n [ ~ ] $ rotterdamctl example.cfg expand\r\n\r\nThe master processes will log that a new consumer is added::\r\n\r\n INFO:rotterdam.master:Upping number of consumers to 3\r\n INFO:rotterdam.master:Starting up consumer\r\n\r\nContracting the number of consumers is a similiar process, but with the\r\n``contract`` command::\r\n\r\n [ ~ ] $ rotterdamctl example.cfg contract\r\n\r\n INFO:rotterdam.master:Contracting number of consumers to 2\r\n INFO:rotterdam.master:Consumer exiting\r\n\r\n\r\nReloading configuration settings\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nThe rotterdam master process has a facility for reloading its config file\r\non-the-fly so no work is lost. It is invoked with the ``reload`` command to\r\n``rotterdamctl``.::\r\n\r\n [ ~ ] $ rotterdamctl example.cfg reload\r\n\r\nThe master process will then re-read the config file and signal each worker\r\nprocess to wrap up whatever it's doing while at the same time spawning new\r\nworker processes based on the new config.::\r\n\r\n INFO:rotterdam.master:Reloading config\r\n INFO:rotterdam.master:Starting up consumer\r\n INFO:rotterdam.master:Starting up consumer\r\n INFO:rotterdam.master:Consumer exiting\r\n INFO:rotterdam.master:Consumer exiting\r\n\r\n\r\nReloading new code\r\n~~~~~~~~~~~~~~~~~~\r\nNaturally, rotterdam only knows of the jobs available to its python runtime.\r\nWhat to do when you update the code to have shiny new jobs, but you don't want\r\nto shut down or pause any work while updating? For this case there's the\r\n``relaunch`` command::\r\n\r\n [ ~ ] $ rotteramctl example.cfg relaunch\r\n\r\nThe master process will spawn a new master with the same arguments it was invoked\r\nwith and passes along the listening socket's file descriptor.::\r\n\r\n INFO:rotterdam.master:Winding down old master\r\n INFO:rotterdam.master:Starting master (52580)\r\n INFO:rotterdam.master:Listening on port 8765\r\n INFO:rotterdam.master:Starting up consumer\r\n INFO:rotterdam.master:Starting up consumer\r\n INFO:rotterdam.master:Consumer exiting\r\n INFO:rotterdam.master:Consumer exiting\r\n [ ~ ] $\r\n\r\nOnce the new master is up and running, the old master process signals its child\r\nworker processes to wrap up what they're doing and shuts itself down while the\r\nnew master processes chugs along and accepts data on the same socket but with\r\nfreshly-loaded python code.\r\n\r\nShutting down\r\n~~~~~~~~~~~~~\r\nStopping rotterdam is done via the ``stop`` command::\r\n\r\n [ ~ ] $ rotterdamctl example.cfg stop\r\n\r\n INFO:rotterdam.master:Winding down master\r\n INFO:rotterdam.master:Consumer exiting\r\n INFO:rotterdam.master:Consumer exiting\r\n\r\nLicense\r\n-------\r\n\r\n\\(c\\) 2013-2015 William Glass\r\n\r\nRotterdam licensed under the terms of the MIT license. See the LICENSE_ file\r\nfor more details.\r\n\r\n\r\n.. _Redis: http://redis.io/\r\n.. _Unicorn: http://unicorn.bogomips.org\r\n.. _Gunicorn: https://github.com/benoitc/gunicorn\r\n.. _LICENSE: https://github.com/wglass/rotterdam/blob/master/README.md", "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/wglass/rotterdam", "keywords": "redis, async, job queue", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rotterdam", "package_url": "https://pypi.org/project/rotterdam/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rotterdam/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/wglass/rotterdam" }, "release_url": "https://pypi.org/project/rotterdam/0.5.6/", "requires_dist": null, "requires_python": null, "summary": "Simple asynchronous job queue via redis.", "version": "0.5.6" }, "last_serial": 1697660, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "97921f9c91f30daf32ca075b9de2374b", "sha256": "1d68dc77acc1a3b990321fe49483b32fbba8127e95225e4db06793b97e9988c2" }, "downloads": -1, "filename": "rotterdam-0.0.5.tar.gz", "has_sig": false, "md5_digest": "97921f9c91f30daf32ca075b9de2374b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7782, "upload_time": "2013-10-04T05:27:45", "url": "https://files.pythonhosted.org/packages/45/01/65ba5af0cec2edb07cc7858a5c05f8d3b32a199d4377b385985c4a7311c4/rotterdam-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "9a92344312561a46f32365992fb7cc6b", "sha256": "e314d45928a68cfa3edfe23e1ee09f95e3880b86462a5f3f6f30f3951bb44325" }, "downloads": -1, "filename": "rotterdam-0.0.6.tar.gz", "has_sig": false, "md5_digest": "9a92344312561a46f32365992fb7cc6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10050, "upload_time": "2013-10-04T05:50:51", "url": "https://files.pythonhosted.org/packages/54/a0/7584479553d67abc6d9ee6d86a33b6a40b1e592647e1841848c9af7d0ea9/rotterdam-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "5e006fa15996b2e14ef92c05b88a7ab9", "sha256": "6d2938c26aeb13efbfba8b4cc70ff165fb9135632fb20b4425807f8b486f5072" }, "downloads": -1, "filename": "rotterdam-0.0.7.tar.gz", "has_sig": false, "md5_digest": "5e006fa15996b2e14ef92c05b88a7ab9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10264, "upload_time": "2013-10-04T06:07:50", "url": "https://files.pythonhosted.org/packages/2c/1a/1e94f123d7a68442e4d67a0ce56d177a1a3882772552b3c069a17efeb329/rotterdam-0.0.7.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "0d690c379ae0d34820706a642c0464b0", "sha256": "c438dcedbb31574f067e58bb256db1beedb4d9752bdb562dedccd6f13fca8d0f" }, "downloads": -1, "filename": "rotterdam-0.5.2.tar.gz", "has_sig": false, "md5_digest": "0d690c379ae0d34820706a642c0464b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13314, "upload_time": "2015-04-16T07:06:33", "url": "https://files.pythonhosted.org/packages/e6/02/9742349bdb61fbb5d9bfe4616c44200b76d04f4c9b13febffa42555285a1/rotterdam-0.5.2.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "02b33ed93e2b9967e0f9e3045438c441", "sha256": "ec64d2ce006295f14320bf401e5a7c4145e970ecdfb617627f4f66de3b731979" }, "downloads": -1, "filename": "rotterdam-0.5.5.tar.gz", "has_sig": false, "md5_digest": "02b33ed93e2b9967e0f9e3045438c441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13251, "upload_time": "2015-04-16T07:48:30", "url": "https://files.pythonhosted.org/packages/b4/20/a536d26638232361440fd4706f9c751ef7e78f8b608f2513c7b86c92e7fb/rotterdam-0.5.5.tar.gz" } ], "0.5.6": [ { "comment_text": "", "digests": { "md5": "eb40dcb29edd2d5337176d05de58ef93", "sha256": "e936d484887febbe2b14ba206ae50722829e59ba2cfa8e420cc48c4203c21a8e" }, "downloads": -1, "filename": "rotterdam-0.5.6.tar.gz", "has_sig": false, "md5_digest": "eb40dcb29edd2d5337176d05de58ef93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13694, "upload_time": "2015-04-16T08:03:01", "url": "https://files.pythonhosted.org/packages/f8/2d/7cbd70bb99eb494cbd7f76038a0e8e49eb051ebe9795f282944cac5c4e7d/rotterdam-0.5.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eb40dcb29edd2d5337176d05de58ef93", "sha256": "e936d484887febbe2b14ba206ae50722829e59ba2cfa8e420cc48c4203c21a8e" }, "downloads": -1, "filename": "rotterdam-0.5.6.tar.gz", "has_sig": false, "md5_digest": "eb40dcb29edd2d5337176d05de58ef93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13694, "upload_time": "2015-04-16T08:03:01", "url": "https://files.pythonhosted.org/packages/f8/2d/7cbd70bb99eb494cbd7f76038a0e8e49eb051ebe9795f282944cac5c4e7d/rotterdam-0.5.6.tar.gz" } ] }