{ "info": { "author": "Omar Bohsali", "author_email": "omar.bohsali@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Elon\n\n[![pypi-version]][pypi]\n\n\nElon is a lightweight async job queue backed by redis.\n\n## Why the name?\n\nBecause Elon Musk gets things done.\n\n## What it does?\n\nSay you have a Django or Flask application that is heavily network- or IO-bound. Say in this app you have a view that makes a slow backend API call. When a user visits this view, your web worker gets tied up until the API responds, which severely limits your throughput. In some cases, you must wait for the API's response to generate your response (in which case I'd recommend Tornado), but in others you might not need the response right away, and in this case, Elon is perfect for your situation.\n\n## Example\n\nHere is a long-running task - pretend that instead of waiting 10 seconds, it's actually hitting a backend API.\n\n```python\nimport time\ndef long_api_request():\n time.sleep(10)\n```\n\nWe could rewrite it as an async task using elon:\n\n```python\nimport asyncio\nfrom tasklib import task\n\n@task\nasync def long_api_request():\n await asyncio.sleep(10)\n```\n\nWhen it comes to calling the task, before:\n\n```python\n@app.route('/enqueue_task')\ndef enqueue_task():\n # Runs the task and returns once it is complete.\n long_running_process()\n return 'Success!'\n```\n\nAfter:\n\n```python\n@app.route('/enqueue_task')\ndef enqueue_task():\n # Enqueue the task and return instantly.\n long_running_process.enqueue()\n return 'Success!'\n```\n\nWhen you call `enqueue()` on a task, you'll instantly receive a UUID, which you can use to query for the result and see job progress.\n\nDecorating classes:\n\nYou can also decorate classes, as long as they inherit from `Task`. Example:\n\n```python\nclass ComplexTask(Task):\n def execute(self):\n pass\n```\n\nClasses that inherit from Task must define their own `execute` method - this is the method run to actually call the task.\n\n[pypi-version]: https://img.shields.io/pypi/v/elon.svg\n[pypi]: https://pypi.org/project/elon/", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/omarish/elon", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "elon", "package_url": "https://pypi.org/project/elon/", "platform": "", "project_url": "https://pypi.org/project/elon/", "project_urls": { "Homepage": "http://github.com/omarish/elon" }, "release_url": "https://pypi.org/project/elon/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "Lightweight async job queue backed by redis.", "version": "0.2.2" }, "last_serial": 3921070, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "cca4e1e21a024383bd9dd8d12c880d55", "sha256": "de98819732bd243e222e7b4234991a98b2c471e68a81e0161fa8a508163632b8" }, "downloads": -1, "filename": "elon-0.2.1.tar.gz", "has_sig": false, "md5_digest": "cca4e1e21a024383bd9dd8d12c880d55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5574, "upload_time": "2018-05-31T23:41:41", "url": "https://files.pythonhosted.org/packages/bc/ce/8b0c818ef89a49f8f6906f52ed868517c35b9d4defc641e68c1856858d42/elon-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "51b662932fa935fc09281b275dee19bd", "sha256": "b57eea9874e117f962e4e9673c6929d537aa6139d7a712e66e87dfa142130fa0" }, "downloads": -1, "filename": "elon-0.2.2.tar.gz", "has_sig": false, "md5_digest": "51b662932fa935fc09281b275dee19bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6178, "upload_time": "2018-06-01T15:32:04", "url": "https://files.pythonhosted.org/packages/0c/bc/470624ebc39808f4b8beb4f2201e924fbe36dcf44bcb01ff213d5d619eb0/elon-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "51b662932fa935fc09281b275dee19bd", "sha256": "b57eea9874e117f962e4e9673c6929d537aa6139d7a712e66e87dfa142130fa0" }, "downloads": -1, "filename": "elon-0.2.2.tar.gz", "has_sig": false, "md5_digest": "51b662932fa935fc09281b275dee19bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6178, "upload_time": "2018-06-01T15:32:04", "url": "https://files.pythonhosted.org/packages/0c/bc/470624ebc39808f4b8beb4f2201e924fbe36dcf44bcb01ff213d5d619eb0/elon-0.2.2.tar.gz" } ] }