celery-director


Namecelery-director JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/ovh/celery-director
SummaryCelery Director
upload_time2022-12-09 13:44:16
maintainer
docs_urlNone
authorOVHcloud
requires_python~=3.7
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img alt="Celery Director logo" src="https://raw.githubusercontent.com/ovh/celery-director/master/logo.png">
</p>
<p align="center">
  <a href="https://github.com/ovh/celery-director/actions/workflows/tests.yml"><img alt="Tests" src="https://github.com/ovh/celery-director/workflows/Tests/badge.svg"></a>
  <a href="https://www.python.org/"><img alt="Python versions" src="https://img.shields.io/badge/python-3.7%2B-blue.svg"></a>
  <a href="https://github.com/ovh/depc/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg"></a>
  <a href="https://github.com/python/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>
<p align="center">
  <a href="https://raw.githubusercontent.com/ovh/celery-director/master/director.gif"><img alt="Celery Director" src="https://raw.githubusercontent.com/ovh/celery-director/master/director.gif"></a>
</p>

----------------

Director is a simple and rapid framework used to manage tasks and build workflows using Celery.

The objective is to make Celery easier to use by providing :

- a WebUI, an API and a CLI to manage and execute the workflows,
- a WebUI to track the tasks states,
- a YAML syntax used to combine tasks into workflows,
- the ability to periodically launch a whole workflow,
- and many others.

See how to use Director with the quickstart and guides in the [documentation](https://ovh.github.io/celery-director/).

## Installation

Install the latest version of Director with pip (requires at least `Python 3.7`):

```bash
pip install celery-director
```

## Usage

### Write your code in Python

```python
# tasks/orders.py
from director import task
from .utils import Order, Mail

@task(name="ORDER_PRODUCT")
def order_product(*args, **kwargs):
    order = Order(
      user=kwargs["payload"]["user"],
      product=kwargs["payload"]["product"]
    ).save()
    return {"id": order.id}

@task(name="SEND_MAIL")
def send_mail(*args, **kwargs):
    order_id = args[0]["id"]
    mail = Mail(
      title=f"Your order #{order_id} has been received",
      user=kwargs["payload"]["user"]
    )
    mail.send()
```

### Build your workflows in YAML

```yaml
# workflows.yml
product.ORDER:
  tasks:
    - ORDER_PRODUCT
    - SEND_MAIL
```

### Run it

You can simply test your workflow in local :

```bash
$ director workflow run product.ORDER '{"user": 1234, "product": 1000}'
```

And run it in production using the director API :

```bash
$ curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"project": "product", "name": "ORDER", "payload": {"user": 1234, "product": 1000}}' \
  http://localhost:8000/api/workflows
```

Read the [documentation](https://ovh.github.io/celery-director/) to try the quickstart and see advanced usages of Celery Director.

## Project layout

    .env                # The configuration file.
    workflows.yml       # The workflows definition.
    tasks/
        example.py      # A file containing some tasks.
        ...             # Other files containing other tasks.

## Commands

* `director init [path]` - Create a new project.
* `director celery [worker|beat|flower]` - Start Celery daemons.
* `director webserver` - Start the webserver.
* `director workflow [list|show|run]` - Manage your project workflows.

## License

See https://github.com/ovh/celery-director/blob/master/LICENSE

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ovh/celery-director",
    "name": "celery-director",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "OVHcloud",
    "author_email": "opensource@ovhcloud.com",
    "download_url": "https://files.pythonhosted.org/packages/80/b5/56a26aedc8126269308fdd217a9372a126e7760ca6fd08eb7e190ab65252/celery-director-0.7.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img alt=\"Celery Director logo\" src=\"https://raw.githubusercontent.com/ovh/celery-director/master/logo.png\">\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/ovh/celery-director/actions/workflows/tests.yml\"><img alt=\"Tests\" src=\"https://github.com/ovh/celery-director/workflows/Tests/badge.svg\"></a>\n  <a href=\"https://www.python.org/\"><img alt=\"Python versions\" src=\"https://img.shields.io/badge/python-3.7%2B-blue.svg\"></a>\n  <a href=\"https://github.com/ovh/depc/blob/master/LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/badge/license-BSD%203--Clause-blue.svg\"></a>\n  <a href=\"https://github.com/python/black\"><img alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"></a>\n</p>\n<p align=\"center\">\n  <a href=\"https://raw.githubusercontent.com/ovh/celery-director/master/director.gif\"><img alt=\"Celery Director\" src=\"https://raw.githubusercontent.com/ovh/celery-director/master/director.gif\"></a>\n</p>\n\n----------------\n\nDirector is a simple and rapid framework used to manage tasks and build workflows using Celery.\n\nThe objective is to make Celery easier to use by providing :\n\n- a WebUI, an API and a CLI to manage and execute the workflows,\n- a WebUI to track the tasks states,\n- a YAML syntax used to combine tasks into workflows,\n- the ability to periodically launch a whole workflow,\n- and many others.\n\nSee how to use Director with the quickstart and guides in the [documentation](https://ovh.github.io/celery-director/).\n\n## Installation\n\nInstall the latest version of Director with pip (requires at least `Python 3.7`):\n\n```bash\npip install celery-director\n```\n\n## Usage\n\n### Write your code in Python\n\n```python\n# tasks/orders.py\nfrom director import task\nfrom .utils import Order, Mail\n\n@task(name=\"ORDER_PRODUCT\")\ndef order_product(*args, **kwargs):\n    order = Order(\n      user=kwargs[\"payload\"][\"user\"],\n      product=kwargs[\"payload\"][\"product\"]\n    ).save()\n    return {\"id\": order.id}\n\n@task(name=\"SEND_MAIL\")\ndef send_mail(*args, **kwargs):\n    order_id = args[0][\"id\"]\n    mail = Mail(\n      title=f\"Your order #{order_id} has been received\",\n      user=kwargs[\"payload\"][\"user\"]\n    )\n    mail.send()\n```\n\n### Build your workflows in YAML\n\n```yaml\n# workflows.yml\nproduct.ORDER:\n  tasks:\n    - ORDER_PRODUCT\n    - SEND_MAIL\n```\n\n### Run it\n\nYou can simply test your workflow in local :\n\n```bash\n$ director workflow run product.ORDER '{\"user\": 1234, \"product\": 1000}'\n```\n\nAnd run it in production using the director API :\n\n```bash\n$ curl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"project\": \"product\", \"name\": \"ORDER\", \"payload\": {\"user\": 1234, \"product\": 1000}}' \\\n  http://localhost:8000/api/workflows\n```\n\nRead the [documentation](https://ovh.github.io/celery-director/) to try the quickstart and see advanced usages of Celery Director.\n\n## Project layout\n\n    .env                # The configuration file.\n    workflows.yml       # The workflows definition.\n    tasks/\n        example.py      # A file containing some tasks.\n        ...             # Other files containing other tasks.\n\n## Commands\n\n* `director init [path]` - Create a new project.\n* `director celery [worker|beat|flower]` - Start Celery daemons.\n* `director webserver` - Start the webserver.\n* `director workflow [list|show|run]` - Manage your project workflows.\n\n## License\n\nSee https://github.com/ovh/celery-director/blob/master/LICENSE\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Celery Director",
    "version": "0.7.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "2446e0e688ab3e0b5443b970dd902b73",
                "sha256": "73d69555c74d3c27d394d0b37f0cb27efee7cee44bc66b7ada643cb0e6960dab"
            },
            "downloads": -1,
            "filename": "celery_director-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2446e0e688ab3e0b5443b970dd902b73",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 57277,
            "upload_time": "2022-12-09T13:44:14",
            "upload_time_iso_8601": "2022-12-09T13:44:14.147891Z",
            "url": "https://files.pythonhosted.org/packages/4c/c2/6d7168ac54fb371f42786fbf6161d1bcb713ff2916bbc6f7042eb30f5b36/celery_director-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "2cf00169034e0ba988c72e99dc19e993",
                "sha256": "903628d959012010a2ad11f8fc0cf7422944669286594a04fbe59349f67129ee"
            },
            "downloads": -1,
            "filename": "celery-director-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2cf00169034e0ba988c72e99dc19e993",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 44867,
            "upload_time": "2022-12-09T13:44:16",
            "upload_time_iso_8601": "2022-12-09T13:44:16.220096Z",
            "url": "https://files.pythonhosted.org/packages/80/b5/56a26aedc8126269308fdd217a9372a126e7760ca6fd08eb7e190ab65252/celery-director-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-09 13:44:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "ovh",
    "github_project": "celery-director",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "celery-director"
}
        
Elapsed time: 0.01600s