{ "info": { "author": "Daniel Debonzi", "author_email": "debonzi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Object Brokering" ], "description": "[![Build Status](https://travis-ci.org/debonzi/celery_crossover.svg?branch=master)](https://travis-ci.org/debonzi/celery_crossover)\n[![PyPI](https://img.shields.io/pypi/v/celery_crossover.svg)](https://github.com/debonzi/celery_crossover)\n[![PyPI](https://img.shields.io/pypi/pyversions/celery_crossover.svg)](https://github.com/debonzi/celery_crossover)\n[![Coverage Status](https://coveralls.io/repos/github/debonzi/celery_crossover/badge.svg)](https://coveralls.io/github/debonzi/celery_crossover)\n\n# Celery Crossover (Alpha)\n\n## About\nCelery crossover aims to make it easier to execute celery tasks from a diffent source code base in the most simple and yet reliable way.\n\n![Use Case](https://raw.githubusercontent.com/debonzi/celery_crossover/master/docs/CeleryCrossoverUseCase.png)\n\n## Quick Examples\n\n### 1) Simple Alice task execution triggered by Bob\nLets suppose Bob is a service that needs Alice to execute the task ```plus``` defined on Alice with the following code:\n\n#### Alice:\n * celery_config.py\n```python\n# -*- coding: utf-8 -*-\nfrom kombu import Exchange, Queue\n\nBROKER_URL = 'redis://localhost:6379/1'\nCELERY_QUEUES = [\n Queue('alice_queue', Exchange('alice_queue'), routing_key='alice_queue')\n]\n```\n\n * alice.py \n```python\n# -*- encoding: utf-8 -*-\nimport crossover\nfrom celery import Celery\n\napp = Celery('tasks')\napp.config_from_object('celery_config')\n\n# The line bellow will make Alice's Tasks usable by other services.\ncrossover.register_router(app)\n\n\n@app.task(name='plus', queue='alice_queue')\ndef plus(x, y):\n _add = x + y\n return _add\n\n```\n\n#### Bob:\nAll that Bob need to do is:\n* exec_task_on_alice.py \n```python\n# -*- encoding: utf-8 -*-\nfrom crossover import Client\n\nalice_broker = \"redis://localhost:6379/1\"\nalice_client = Client(broker=alice_broker)\n\nalice_client.plus(x=340, y=210)\n\n```\n\n### 2) Alice task execution triggered by Bob with callback (Auto Callback)\nIn the same scenario described above, lets suppose Bob need to be notified (have a task executed) after Alice is done with the ```plus``` task.\nFor this case, all we have to do is decorate the Alice's task ```plus``` with```@crossover.callback(auto_callback=True)``` to have its returned value sent back to Bob. Also, Bob have to define and send to Alice a task to be called by Alice's callback.\nThat way, Alice and Bob could would be:\n\n#### Alice:\n * alice_celery_config.py\n```python\n# -*- coding: utf-8 -*-\nfrom kombu import Exchange, Queue\n\nBROKER_URL = 'redis://localhost:6379/1'\nCELERY_QUEUES = [\n Queue('alice_queue', Exchange('alice_queue'), routing_key='alice_queue')\n]\n```\n\n * alice.py \n```python\n# -*- encoding: utf-8 -*-\nimport crossover\nfrom celery import Celery\n\napp = Celery('tasks')\napp.config_from_object('alice_celery_config')\n\n# The line bellow will make Alice's Tasks usable by other services.\ncrossover.register_router(app)\n\n\n@app.task(name='plus', queue='alice_queue')\n@crossover.callback(auto_callback=True)\ndef plus(x, y):\n _add = x + y\n return _add\n\n```\n\n#### Bob:\n * bob_celery_conf.py\n```python\n# -*- coding: utf-8 -*-\nfrom kombu import Exchange, Queue\n\nBROKER_URL = 'redis://localhost:6379/1'\n\nCELERY_QUEUES = [\n Queue('bob_queue', Exchange('bob_queue'), routing_key='bob_queue')\n]\n\n```\n * bob.py\n```python\n# -*- encoding: utf-8 -*-\nimport crossover\nfrom celery import Celery\nfrom celery.utils.log import get_task_logger\n\nlogger = get_task_logger(__name__)\n\napp = Celery('tasks')\napp.config_from_object('bob_celery_conf')\n\ncrossover.register_router(app)\n\n@app.task(name='plus_callback', queue='bob_queue')\ndef plus_callback(result):\n logger.info('Got Addition callback = {0}'.format(result))\n\n```\n\n * exec_task_on_alice.py \n```python\n# -*- encoding: utf-8 -*-\nfrom crossover import Client\nfrom bob import plus_callback\n\nalice_broker = \"redis://localhost:6379/1\"\nalice_client = Client(broker=alice_broker)\n\nalice_client.plus(x=340, y=210, callback=plus_callback)\n\n```\n\n### 3) Alice task execution triggered by Bob with callback (No Auto Callback)\nIn this case, everything is the same as 2) from Bob's perspective but lets suppose Alice's task cant calculate or\ndetermine a response right away so it needs to pass (or persist) the callback metadata for further execution.\nIt can be done by using de decorator ```@crossover.callback``` with ```bind_callback_meta=True``` which will give\nto the task function the callback metadata as its first parameters. Following an example of its usage:\n\n * alice.py\n\n```python\n# -*- encoding: utf-8 -*-\n...\n\n@app.task(name='plus', queue='alice_queue')\n@crossover.callback(bind_callback_meta=True)\ndef plus(callback_meta, x, y):\n logger.info('Execution actual addition task.')\n calculate_addition.delay(callback_meta, x, y):\n\n\n@app.task(name='calculate_addition', queue='project_1')\ndef calculate_addition(callback_meta, x, y):\n _add = x + y\n logger.info('Addition {0} + {1} = {2}'.format(x, y, _add))\n crossover.CallBack(callback_meta)(result=_add)\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/debonzi/celery_crossover", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "celery-crossover", "package_url": "https://pypi.org/project/celery-crossover/", "platform": "", "project_url": "https://pypi.org/project/celery-crossover/", "project_urls": { "Homepage": "https://github.com/debonzi/celery_crossover" }, "release_url": "https://pypi.org/project/celery-crossover/1.1.11/", "requires_dist": null, "requires_python": "", "summary": "Celery Crossover aims to make it really easy to execute tasks in another service.", "version": "1.1.11" }, "last_serial": 5908339, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "8702b6102b7b7fd1bdcf040dfdbeac6d", "sha256": "f44c7b3d8c984edd64efddf8075df606d63d3431da6de1981b36c6c0e4817665" }, "downloads": -1, "filename": "celery-crossover-1.0.0.tar.gz", "has_sig": false, "md5_digest": "8702b6102b7b7fd1bdcf040dfdbeac6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1905, "upload_time": "2017-09-25T00:30:48", "url": "https://files.pythonhosted.org/packages/17/de/acc5f9136fb786278f296fc2c13b9fb77a1498148f91b86a1b78e2dea08a/celery-crossover-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "d769ca52a42e1547468c7457b304c0b9", "sha256": "41717fe140ca66acf1fbb064a3d4c93b9f99392453db6fd6e2483abd4b1db722" }, "downloads": -1, "filename": "celery-crossover-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d769ca52a42e1547468c7457b304c0b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1891, "upload_time": "2017-09-25T19:35:07", "url": "https://files.pythonhosted.org/packages/69/48/0d1ec0ecc27c00eeee9fbfc97fbf85d68126db26053f1aef30be06233ffc/celery-crossover-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "09beb6920d42878e28b1a9688a30dab9", "sha256": "3e21d7de910b4d0cf909047370a4c73a5951ea22388743c730aa4d1cca43295b" }, "downloads": -1, "filename": "celery-crossover-1.1.0.tar.gz", "has_sig": false, "md5_digest": "09beb6920d42878e28b1a9688a30dab9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1966, "upload_time": "2017-09-26T07:17:11", "url": "https://files.pythonhosted.org/packages/3d/db/8d911c683388f1f2ed1fc484d54a568179e7c977b22f7f503b7081d2d8cc/celery-crossover-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "b8a464a2f03c083eb222784d81108a92", "sha256": "762f47ed7bf212718af2a2b8b585101566f3e52a41c1f9afab2ef42b370f3193" }, "downloads": -1, "filename": "celery-crossover-1.1.1.tar.gz", "has_sig": false, "md5_digest": "b8a464a2f03c083eb222784d81108a92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1987, "upload_time": "2017-09-26T15:21:32", "url": "https://files.pythonhosted.org/packages/44/3d/e5192589c9f23265249719b14bd498c3f92b4c11820089eeb237c620da14/celery-crossover-1.1.1.tar.gz" } ], "1.1.10": [ { "comment_text": "", "digests": { "md5": "be7e41e1f748d213cabfabfaca6f1cd0", "sha256": "f80be9bfb9183d897aa2fa034da7c1d95169c17242d801fd90077159c4de2608" }, "downloads": -1, "filename": "celery-crossover-1.1.10.tar.gz", "has_sig": false, "md5_digest": "be7e41e1f748d213cabfabfaca6f1cd0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6417, "upload_time": "2018-08-16T21:32:19", "url": "https://files.pythonhosted.org/packages/b7/e0/d1497aae642676c5cdc693735a5fc53d8d03ee03797cded2eb6461b4a225/celery-crossover-1.1.10.tar.gz" } ], "1.1.11": [ { "comment_text": "", "digests": { "md5": "8f0cd0004822cff63bf938eece216441", "sha256": "f08884682e1e38ae237f3e52b9204cd8fc13af2519eab36171640e09c45b83ed" }, "downloads": -1, "filename": "celery-crossover-1.1.11.tar.gz", "has_sig": false, "md5_digest": "8f0cd0004822cff63bf938eece216441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5856, "upload_time": "2019-09-30T18:27:58", "url": "https://files.pythonhosted.org/packages/28/44/d43a3b47a87553f8b237abeeb37b0a947d0e83aa1c0434c1dedc155d66ba/celery-crossover-1.1.11.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "41373d3be2bd6e3b870d0766fd1b6e4f", "sha256": "fbae8509725faaf5e673f5756f9b2d4dbec780d9ff5f3a05901eed9246a4beff" }, "downloads": -1, "filename": "celery-crossover-1.1.2.tar.gz", "has_sig": false, "md5_digest": "41373d3be2bd6e3b870d0766fd1b6e4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3636, "upload_time": "2017-10-02T22:44:08", "url": "https://files.pythonhosted.org/packages/bb/c5/84e8977a3a8bff5392c4087a632360bf1e86d8910f934cc0795ef4a2a323/celery-crossover-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "f70eaa4fff1e93b830eb5091c96dc85c", "sha256": "06970dd0ed5f69183de9f9c745978e01fee0a7d466581deafcb0be417e81f2d7" }, "downloads": -1, "filename": "celery-crossover-1.1.3.tar.gz", "has_sig": false, "md5_digest": "f70eaa4fff1e93b830eb5091c96dc85c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4753, "upload_time": "2017-10-24T19:44:45", "url": "https://files.pythonhosted.org/packages/5a/48/7d1359dacd8396811378891a004a6de0b0b1b90089311e22778afb39a505/celery-crossover-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "6c653897d5e1e37391e68b504f0c211b", "sha256": "00cff1a6381246dc9544d0a685187819638113f958c7b1719a7d576b9904db97" }, "downloads": -1, "filename": "celery-crossover-1.1.4.tar.gz", "has_sig": false, "md5_digest": "6c653897d5e1e37391e68b504f0c211b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4776, "upload_time": "2017-10-24T20:19:13", "url": "https://files.pythonhosted.org/packages/1c/3b/418467b0ed8706e9bbd8a012404d78575281fe744ae73c91276302bda66a/celery-crossover-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "b16abe97866b7268f8915f21fc5f1f5b", "sha256": "bb2fd09b13778be28d5829ccdb73661352bc0ef4e4713bc8f15c8c7df6799211" }, "downloads": -1, "filename": "celery-crossover-1.1.5.tar.gz", "has_sig": false, "md5_digest": "b16abe97866b7268f8915f21fc5f1f5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3858, "upload_time": "2017-10-26T19:08:52", "url": "https://files.pythonhosted.org/packages/51/52/5b2d12f81fa8e6951d0e4ecd9e76495d25d97c9e9fa62e9ea131a7700bee/celery-crossover-1.1.5.tar.gz" } ], "1.1.6": [ { "comment_text": "", "digests": { "md5": "795c9c76548b1210b5b2791424a32866", "sha256": "9523d87649aed012505644dc880914e69b0ce6fbbedbdd6df64eac6affa7b20c" }, "downloads": -1, "filename": "celery-crossover-1.1.6.tar.gz", "has_sig": false, "md5_digest": "795c9c76548b1210b5b2791424a32866", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4882, "upload_time": "2018-04-10T19:59:12", "url": "https://files.pythonhosted.org/packages/b4/0d/e4bfee00c14297779e4e7aacd49b279f9d7c0b2a1767a8e55df89feded6c/celery-crossover-1.1.6.tar.gz" } ], "1.1.7": [ { "comment_text": "", "digests": { "md5": "508980cde5631e4df2b1425ea789dc00", "sha256": "abda63602517c92f2b8dd1b02098ab3a444037c86f1e35b2ca83b2d10d166013" }, "downloads": -1, "filename": "celery-crossover-1.1.7.tar.gz", "has_sig": false, "md5_digest": "508980cde5631e4df2b1425ea789dc00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4883, "upload_time": "2018-04-11T15:23:10", "url": "https://files.pythonhosted.org/packages/23/24/0b9fd5c9d45dbb21cbc7c57de17ad7a371351eb85b7fb4c2b387d5cf8810/celery-crossover-1.1.7.tar.gz" } ], "1.1.8": [ { "comment_text": "", "digests": { "md5": "098a2eb5e452e96bfb0cbe42048cf91d", "sha256": "529b6a9e382aa93b28f481ce3f8893a835fed1cfba7f7bcb014665593970d5e1" }, "downloads": -1, "filename": "celery-crossover-1.1.8.tar.gz", "has_sig": false, "md5_digest": "098a2eb5e452e96bfb0cbe42048cf91d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5307, "upload_time": "2018-04-11T23:27:37", "url": "https://files.pythonhosted.org/packages/9e/be/43d2c78c29c6ea6567c0c93fddd9908032243728ba6d59bf8331316203b3/celery-crossover-1.1.8.tar.gz" } ], "1.1.9": [ { "comment_text": "", "digests": { "md5": "edcfd11ce147e3308e8321b58e0baffe", "sha256": "8c64b0f5bd3bdc278fc6c52b1377821cad9090e5cca070df4478d33a8be61d81" }, "downloads": -1, "filename": "celery-crossover-1.1.9.tar.gz", "has_sig": false, "md5_digest": "edcfd11ce147e3308e8321b58e0baffe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5406, "upload_time": "2018-08-15T18:19:48", "url": "https://files.pythonhosted.org/packages/5c/7e/99967905a548933fb469b0ef8c16165c74f1f46893e80d849912f8ed14ed/celery-crossover-1.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8f0cd0004822cff63bf938eece216441", "sha256": "f08884682e1e38ae237f3e52b9204cd8fc13af2519eab36171640e09c45b83ed" }, "downloads": -1, "filename": "celery-crossover-1.1.11.tar.gz", "has_sig": false, "md5_digest": "8f0cd0004822cff63bf938eece216441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5856, "upload_time": "2019-09-30T18:27:58", "url": "https://files.pythonhosted.org/packages/28/44/d43a3b47a87553f8b237abeeb37b0a947d0e83aa1c0434c1dedc155d66ba/celery-crossover-1.1.11.tar.gz" } ] }