{ "info": { "author": "Thread", "author_email": "tech@thread.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only" ], "description": "# dqueue\n\ndqueue is an _experimental_ fork of\n[django-lightweight-queue](https://github.com/thread/django-lightweight-queue),\ntargeting greater flexibility.\n\nThe rest of this document may be incorrect as we experiment with alternative\nconfigurations.\n\n## Basic Usage\n\n```python\nimport time\nfrom dqueue import task\n\n# Define a task\n@task()\ndef long_running_task(first_arg, second_arg):\n time.sleep(first_arg * second_arg)\n\n# Request that the task be executed at some point\nlong_running_task(4, second_arg=9)\n```\n\nSee the docstring on the [`task`](dqueue/task.py) decorator\nfor more details.\n\n## Configuration\n\nAll automatically picked up configuration options begin with `DQUEUE_` and can\nbe found in `app_settings.py`. They should be placed in the usual Django\nsettings files, for example:\n\n```python\nDQUEUE_BACKEND = 'dqueue.backends.redis.RedisBackend'\n```\n\nIf desired, specific configuration overrides can be placed in a standalone\npython file which passed on the command line.\n\nFor example, given a `special.py` containing:\n\n```python\nDQUEUE_REDIS_PORT = 12345\n```\n\nand then running:\n\n```\n$ python manage.py queue_runner --config=special.py\n```\n\nwill result in the runner to use the settings from the specified configuration\nfile in preference to settings from the Django environment. Any settings not\npresent in the specified file are inherited from the global configuration.\n\n### Backends\n\nThere are three built-in backends:\n\n- Synchronous (the default): executes the task inline, without any actual queuing\n- Redis: executes tasks at-most-once using [Redis][redis] for storage of the\n enqueued tasks\n- Reliable Redis: executes tasks at-least-once using [Redis][redis] for storage\n of the enqueued tasks\n\n[redis]: https://redis.io/\n\n## Running Workers\n\nThe queue runner is implemented as a Django management command:\n\n```\n$ python manage.py queue_runner\n```\n\nWorkers can be distributed over multiple hosts by telling each runner that it\nis part of a pool:\n\n```\n$ python manage.py queue_runner --machine 2 --of 4\n```\n\nAlternatively a runner can be told explicitly which configuration to use:\n\n```\n$ python manage.py queue_runner --exact-configuration --config=special.py\n```\n\nWhen using `--exact-configuration` the number of workers is configured\nexactly, rather than being treated as the configuration for a pool.\nAdditionally, exactly-configured runners will _not_ run any cron workers.\n\n### Example\n\nGiven a Django configuration containing:\n\n```python\nDQUEUE_WORKERS = {\n 'queue1': 3,\n}\n```\n\nand a `special.py` containing:\n\n```python\nDQUEUE_WORKERS = {\n 'queue1': 2,\n}\n```\n\nRunning any of:\n\n```\n$ python manage.py queue_runner --machine 1 --of 3 # or,\n$ python manage.py queue_runner --machine 2 --of 3 # or,\n$ python manage.py queue_runner --machine 3 --of 3\n```\n\nwill result in one worker for `queue1` on the current machine, while:\n\n```\n$ python manage.py queue_runner --exact-configuration --config=special.py\n```\n\nwill result in two workers on the current machine.\n\n## Cron Tasks\n\nDLQ supports the use of a cron-like specification of Django management\ncommands\nto be run at certain times.\n\nTo specify that a management command should be run at a given time, place a\n`cron.py` file in the root folder of the Django app which defines the command\nand which contains a `CONFIG` variable:\n\n```python\nCONFIG = (\n {\n 'command': 'my_cron_command',\n # Day values 1-7 to match datetime.datetime.utcnow().isoweekday()\n 'days': '*',\n 'hours': '*',\n 'minutes': '*',\n # Equivalent behaviour to the kwarg to `task` of the same name\n 'sigkill_on_stop': True,\n },\n)\n```\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/thread/dqueue", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dqueue", "package_url": "https://pypi.org/project/dqueue/", "platform": "", "project_url": "https://pypi.org/project/dqueue/", "project_urls": { "Homepage": "https://github.com/thread/dqueue" }, "release_url": "https://pypi.org/project/dqueue/0.0.2/", "requires_dist": [ "Django (<3.0,>=1.9.0)", "daemonize", "redis", "prometheus-client" ], "requires_python": "", "summary": "Queuing and cron system for Django", "version": "0.0.2" }, "last_serial": 4447767, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "5b5e9474b3f6fc65bb19aa85fab16258", "sha256": "82ba5f0dde6f287890e111d7d44329567551147b74d0313add88e7444ead6a30" }, "downloads": -1, "filename": "dqueue-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5b5e9474b3f6fc65bb19aa85fab16258", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27111, "upload_time": "2018-11-03T15:54:05", "url": "https://files.pythonhosted.org/packages/9d/c4/e8a6b3a75e3d530d0ce6371d9fa0caf820a57d0770303074fd74cd455fa4/dqueue-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f3943e7dd78af799ede5b571d647961d", "sha256": "4f3bd94f79b57b91efcc91cfa7f3358a0f3cb02612cccf734cbab4dd057460df" }, "downloads": -1, "filename": "dqueue-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f3943e7dd78af799ede5b571d647961d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19362, "upload_time": "2018-11-03T15:54:07", "url": "https://files.pythonhosted.org/packages/dd/46/9e4a212dcb72c8c0144ecc0b5c49d925d20aee2de6473a34aafdba9b3436/dqueue-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "70f39e977310c949ad0a68e41cc8a2b5", "sha256": "2e42745e2612f4f3d92a43602bbdadbcb05bd07714b637b1beaf316cb5acd179" }, "downloads": -1, "filename": "dqueue-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "70f39e977310c949ad0a68e41cc8a2b5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25496, "upload_time": "2018-11-03T16:23:37", "url": "https://files.pythonhosted.org/packages/41/e0/035911ef79c817c6c59b1337393a8d6762c90fc9a70862c70e292860ca10/dqueue-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce6936081459d0c733b6cd3d95e6bbc0", "sha256": "839d22c70292f1ea8cf3c6f9fbc932eec3e257bd74ffb78e71f68863630e1698" }, "downloads": -1, "filename": "dqueue-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ce6936081459d0c733b6cd3d95e6bbc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18448, "upload_time": "2018-11-03T16:23:38", "url": "https://files.pythonhosted.org/packages/16/c8/4f1b573e303940cb719ba2493b14f3ec3909936a74fedb8de0c8e79eb0bb/dqueue-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70f39e977310c949ad0a68e41cc8a2b5", "sha256": "2e42745e2612f4f3d92a43602bbdadbcb05bd07714b637b1beaf316cb5acd179" }, "downloads": -1, "filename": "dqueue-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "70f39e977310c949ad0a68e41cc8a2b5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25496, "upload_time": "2018-11-03T16:23:37", "url": "https://files.pythonhosted.org/packages/41/e0/035911ef79c817c6c59b1337393a8d6762c90fc9a70862c70e292860ca10/dqueue-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce6936081459d0c733b6cd3d95e6bbc0", "sha256": "839d22c70292f1ea8cf3c6f9fbc932eec3e257bd74ffb78e71f68863630e1698" }, "downloads": -1, "filename": "dqueue-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ce6936081459d0c733b6cd3d95e6bbc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18448, "upload_time": "2018-11-03T16:23:38", "url": "https://files.pythonhosted.org/packages/16/c8/4f1b573e303940cb719ba2493b14f3ec3909936a74fedb8de0c8e79eb0bb/dqueue-0.0.2.tar.gz" } ] }