{ "info": { "author": "Remco Wendt", "author_email": "remco.wendt@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Buildout :: Recipe", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n============\n\nBuildout recipe for installing Celery for use with Zope's ZCA and configuring\nit using an ini file.\n\nThis recipe was originally based on collective.recipe.celery,\nbut differs greatly so that it now has become its own package. This recipe\ndefines a custom loader that can read celery configuration from an ini file.\nThis allows you to generate the configuration by using a template for\nexample, using collective.recipe.template. The custom loader also bootstraps\nthe ZCA automatically when a worker initializes.\n\nYou can use it in a part like this::\n\n [celery]\n recipe = md.recipe.celery\n eggs =\n ${buildout:eggs}\n celery[redis]\n celery_conf = etc/celery.ini\n logging_conf = etc/logging.ini\n zope_conf = etc/zope.conf\n\n\nSupported options\n=================\n\nGeneral options\n---------------\n\neggs\n A list of additional eggs you want to make available to Celery. Use this to\n add additional dependencies such as ``kombu-sqlalchemy`` or the module(s)\n containing your task definitions.\n\ncelery_conf\n Location of the Celery configuration .ini file.\n\nlogging_conf\n Location of the file containing the python logging setup\n\nzope_conf\n Location of the zope configuration file.\n\n\nConfiguration\n=============\n\nExample of an ini file that could be used by this recipe::\n\n [celery]\n BROKER_URL = sqlite:///celery_broker.db\n CELERY_IMPORTS = myapp.tasks,otherapp.tasks\n CELERY_RESULT_BACKEND = sqlite:///celery_results.db\n CELERY_RESULT_SERIALIZER = json\n\n [celerybeat:task1]\n # Execute every hour\n task = myapp.tasks.Task1\n type = crontab\n schedule = {\"minute\": 0}\n\n [celerybeat:task2]\n # Execute every 30 seconds\n task = myapp.tasks.Task2\n type = timedelta\n schedule = {\"seconds\": 30}\n\n [celerybeat:task3]\n # Execute at midnight\n task = otherapp.tasks.Task3\n type = crontab\n schedule = {\"hour\": 0, \"minute\": 0}\n\nThe [celery] section defines all the celery options. Every [celerybeat]\nsection defines an individual task.\n\nExample usage\n=============\n\nCreate a celery ini file holding your celery configuration::\n\n >>> write(sample_buildout, 'celery.ini',\n ... \"\"\"\n ... [celery]\n ... BROKER_URL = sqlite:///celery_broker.db\n ... CELERY_IMPORTS = myapp.tasks,otherapp.tasks\n ... CELERY_RESULT_BACKEND = sqlite:///celery_results.db\n ... CELERY_RESULT_SERIALIZER = json\n ...\n ... [celerybeat:task1]\n ... # Execute every hour\n ... task = myapp.tasks.Task1\n ... type = crontab\n ... schedule = {\"minute\": 0}\n ...\n ... [celerybeat:task2]\n ... # Execute every 30 seconds\n ... task = myapp.tasks.Task2\n ... type = timedelta\n ... schedule = {\"seconds\": 30}\n ...\n ... [celerybeat:task3]\n ... # Execute at midnight\n ... task = otherapp.tasks.Task3\n ... type = crontab\n ... schedule = {\"hour\": 0, \"minute\": 0}\"\"\")\n\nThis file could be generated by a template such as collective.recipe.template.\n\nNext create a logging config::\n\n >>> write(sample_buildout, 'logging.ini',\n ... \"\"\"\n ... [loggers]\n ... keys = root\n ...\n ... [handlers]\n ... keys = console\n ...\n ... [formatters]\n ... keys = generic\n ...\n ... [logger_root]\n ... level = INFO\n ... handlers = console\n ...\n ... [handler_console]\n ... class = StreamHandler\n ... args = (sys.stderr,)\n ... level = NOTSET\n ... formatter = generic\n ...\n ... [formatter_generic]\n ... format = %(asctime)s %(levelname)s [%(name)s] %(message)s\"\"\")\n\nThen we'll create a buildout that uses the recipe::\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = celery\n ... index = %(server)s/index\n ... find-links = %(server)s\n ... \n ... [celery]\n ... recipe = md.recipe.celery\n ... celery_conf = celery.ini\n ... logging_conf = logging.ini\n ... zope_conf = zope.conf\n ... \"\"\"% dict(\n ... server=link_server))\n\nRunning the buildout gives us::\n\n >>> print system(buildout)\n Installing celery.\n celery: Creating directory /sample-buildout/parts/celery.\n celery: Generated loader file /sample-buildout/parts/celery/zopeloader.py.\n Getting distribution for 'celery'.\n Got celery 2.3.1.\n Generated script '/sample-buildout/bin/celeryctl'.\n Generated script '/sample-buildout/bin/celeryd'.\n \n\nCheck that we have the celery scripts::\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n - celeryctl\n - celeryd\n\nCheck that we got the celery loaders::\n\n >>> ls(sample_buildout, 'parts', 'celery')\n - loader.py\n - zopeloader.py\n\nIf we run the celeryd script, it prints out the config data::\n\n >>> print(system(join(sample_buildout, 'bin', 'celeryctl')))\n [('BROKER_URL', 'sqlite:///celery_broker.db'),\n ('CELERYBEAT_SCHEDULE',\n {'task1': {'schedule': ,\n 'task': 'myapp.tasks.Task1'},\n 'task2': {'schedule': datetime.timedelta(0, 30),\n 'task': 'myapp.tasks.Task2'},\n 'task3': {'schedule': ,\n 'task': 'otherapp.tasks.Task3'}}),\n ('CELERYD_HIJACK_ROOT_LOGGER', False),\n ('CELERY_IMPORTS', ['myapp.tasks', 'otherapp.tasks']),\n ('CELERY_RESULT_BACKEND', 'sqlite:///celery_results.db'),\n ('CELERY_RESULT_SERIALIZER', 'json')]\n \n\nWe can include additional eggs using the eggs option::\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = celery\n ... index = %(server)s/index\n ... find-links = %(server)s\n ...\n ... [celery]\n ... recipe = md.recipe.celery\n ... eggs =\n ... other\n ... \"\"\"% dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling celery.\n Installing celery.\n celery: Generated loader file /sample-buildout/parts/celery/zopeloader.py.\n Getting distribution for 'other'.\n Got other 1.0.\n Generated script '/sample-buildout/bin/celeryctl'.\n Generated script '/sample-buildout/bin/celeryd'.\n Generated script '/sample-buildout/bin/distutilsscript'.\n\nThe recipe should handle updates as well, trigger this by pinning celery to\nanother version and checking one of the outputted scripts.\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = celery\n ... index = %(server)s/index\n ... find-links = %(server)s\n ...\n ... [versions]\n ... celery = 2.3.0\n ...\n ... [celery]\n ... recipe = md.recipe.celery\n ... eggs =\n ... other\n ... \"\"\"% dict(server=link_server))\n\n >>> print system(buildout),\n Updating celery.\n celery: Generated loader file /sample-buildout/parts/celery/zopeloader.py.\n Getting distribution for 'celery==2.3.0'.\n Got celery 2.3.0.\n Generated script '/sample-buildout/bin/celeryctl'.\n Generated script '/sample-buildout/bin/celeryd'.\n Generated script '/sample-buildout/bin/distutilsscript'.\n\n >>> cat(sample_buildout, 'bin', 'celeryctl')\n #!/Users/rwendt/Projects/python/bin/python\n \n import sys\n sys.path[0:0] = [\n '/sample-buildout/eggs/celery-2.3.0-py2.7.egg',\n '/sample-buildout/eggs/other-1.0-py2.7.egg',\n '/sample-buildout/parts/celery',\n ]\n ***\n\nWe can control which scripts are generated using the scripts option.\nIf no value is given, then script generation is disabled::\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = celery\n ... index = %(server)s/index\n ... find-links = %(server)s\n ...\n ... [celery]\n ... recipe = md.recipe.celery\n ... scripts =\n ... \"\"\"% dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling celery.\n Installing celery.\n celery: Generated loader file /sample-buildout/parts/celery/zopeloader.py.\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n\nLet's create the celeryd script only::\n\n >>> write(sample_buildout, 'buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = celery\n ... index = %(server)s/index\n ... find-links = %(server)s\n ...\n ... [celery]\n ... recipe = md.recipe.celery\n ... scripts =\n ... celeryd\n ... \"\"\"% dict(server=link_server))\n\n >>> print system(buildout),\n Uninstalling celery.\n Installing celery.\n celery: Generated loader file /sample-buildout/parts/celery/zopeloader.py.\n Generated script '/sample-buildout/bin/celeryd'.\n\n >>> ls(sample_buildout, 'bin')\n - buildout\n - celeryd\n\n=======\nCHANGES\n=======\n\n1.1 (2013-12-19)\n================\n\n- Add missing files to Manifest.\n\n\n1.0 (2013-12-18)\n================\n\n- Initial release. Based loosely on collective.recipe.celery.", "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/minddistrict/md.recipe.celery", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "md.recipe.celery", "package_url": "https://pypi.org/project/md.recipe.celery/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/md.recipe.celery/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/minddistrict/md.recipe.celery" }, "release_url": "https://pypi.org/project/md.recipe.celery/1.1/", "requires_dist": null, "requires_python": null, "summary": "Buildout recipe for installing celery for use with Zope's ZCA and configuring it using an ini file.", "version": "1.1" }, "last_serial": 948662, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "b590ffdd2286be5438531a8cfc3fb0ce", "sha256": "11e2d9e4b89bbad272c0627e1f9438b896a151194366bd705940a976a568eed5" }, "downloads": -1, "filename": "md.recipe.celery-1.0.zip", "has_sig": false, "md5_digest": "b590ffdd2286be5438531a8cfc3fb0ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14142, "upload_time": "2013-12-18T17:10:21", "url": "https://files.pythonhosted.org/packages/e7/13/2b911c586658222b764d3089c8937d61451ad1eae8f7c1e986b56700746c/md.recipe.celery-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "cb97ce7a68c68919fedda828cb1debec", "sha256": "ac740e1470734c8f3506792bf6e64ab7e8a32ef3d0fb9bac1ab792d02ac65d78" }, "downloads": -1, "filename": "md.recipe.celery-1.1.zip", "has_sig": false, "md5_digest": "cb97ce7a68c68919fedda828cb1debec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15289, "upload_time": "2013-12-19T10:36:01", "url": "https://files.pythonhosted.org/packages/fc/c7/b239835f97577c2e60ec732bcb0642b213407aa4312a0a806c929c251df9/md.recipe.celery-1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cb97ce7a68c68919fedda828cb1debec", "sha256": "ac740e1470734c8f3506792bf6e64ab7e8a32ef3d0fb9bac1ab792d02ac65d78" }, "downloads": -1, "filename": "md.recipe.celery-1.1.zip", "has_sig": false, "md5_digest": "cb97ce7a68c68919fedda828cb1debec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15289, "upload_time": "2013-12-19T10:36:01", "url": "https://files.pythonhosted.org/packages/fc/c7/b239835f97577c2e60ec732bcb0642b213407aa4312a0a806c929c251df9/md.recipe.celery-1.1.zip" } ] }