procrastinate


Nameprocrastinate JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://procrastinate.readthedocs.io/
SummaryPostgres-based distributed task processing library
upload_time2024-04-17 21:42:48
maintainerNone
docs_urlNone
authorJoachim Jablon
requires_python<4.0,>=3.8
licenseMIT
keywords postgres task-queue
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Procrastinate: PostgreSQL-based Task Queue for Python

[![Deployed to PyPI](https://img.shields.io/pypi/v/procrastinate?logo=pypi&logoColor=white)](https://pypi.org/pypi/procrastinate)
[![Deployed to PyPI](https://img.shields.io/pypi/pyversions/procrastinate?logo=pypi&logoColor=white)](https://pypi.org/pypi/procrastinate)
[![GitHub Repository](https://img.shields.io/github/stars/procrastinate-org/procrastinate?style=flat&logo=github&color=brightgreen)](https://github.com/procrastinate-org/procrastinate/)
[![Continuous Integration](https://img.shields.io/github/actions/workflow/status/procrastinate-org/procrastinate/ci.yml?logo=github&branch=main)](https://github.com/procrastinate-org/procrastinate/actions?workflow=CI)
[![Documentation](https://img.shields.io/readthedocs/procrastinate/stable?logo=read-the-docs&logoColor=white)](https://procrastinate.readthedocs.io/en/stable/badge=stable)
[![Documentation](https://img.shields.io/readthedocs/procrastinate/stable?logo=read-the-docs&logoColor=white)](https://procrastinate.readthedocs.io/en/stable/badge=stable)
[![Coverage badge](https://raw.githubusercontent.com/procrastinate-org/procrastinate/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/procrastinate-org/procrastinate/blob/python-coverage-comment-action-data/htmlcov/index.html)
[![MIT License](https://img.shields.io/github/license/procrastinate-org/procrastinate?logo=open-source-initiative&logoColor=white)](https://github.com/procrastinate-org/procrastinate/blob/main/LICENSE)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](https://github.com/procrastinate-org/procrastinate/blob/main/CODE_OF_CONDUCT.md)
[![Discord](https://img.shields.io/discord/1197292025725329549?logo=discord&logoColor=white&label=Discord&color=%237289da)](https://discord.gg/JWZeNq6P6Z)

**Procrastinate is looking for** [additional maintainers!](https://github.com/procrastinate-org/procrastinate/discussions/748)

Procrastinate is an open-source Python 3.8+ distributed task processing
library, leveraging PostgreSQL to store task definitions, manage locks and
dispatch tasks. It can be used within both sync and async code,
has [Django](howto/django/configuration) integration, and is easy to use with ASGI frameworks.
It supports periodic tasks, retries, arbitrary task locks etc.

In other words, from your main code, you call specific functions (tasks) in a
special way and instead of being run on the spot, they're scheduled to
be run elsewhere, now or in the future.

Here's an example (if you want to run the code yourself, head to [Quickstart]):

```python
# mycode.py
import procrastinate

# Make an app in your code
app = procrastinate.App(connector=procrastinate.SyncPsycopgConnector())

# Then define tasks
@app.task(queue="sums")
def sum(a, b):
    with open("myfile", "w") as f:
        f.write(str(a + b))

with app.open():
    # Launch a job
    sum.defer(a=3, b=5)

# Somewhere in your program, run a worker (actually, it's usually a
# different program than the one deferring jobs for execution)
app.run_worker(queues=["sums"])
```

The worker will run the job, which will create a text file
named `myfile` with the result of the sum `3 + 5` (that's `8`).

Similarly, from the command line:

```bash
export PROCRASTINATE_APP="mycode.app"

# Launch a job
procrastinate defer mycode.sum '{"a": 3, "b": 5}'

# Run a worker
procrastinate worker -q sums
```

Lastly, you can use Procrastinate asynchronously too (actually, it's the
recommended way to use it):

```python
import asyncio

import procrastinate

# Make an app in your code
app = procrastinate.App(connector=procrastinate.PsycopgConnector())

# Define tasks using coroutine functions
@app.task(queue="sums")
async def sum(a, b):
    await asyncio.sleep(a + b)

async with app.open_async():
    # Launch a job
    await sum.defer_async(a=3, b=5)

    # Somewhere in your program, run a worker (actually, it's often a
    # different program than the one deferring jobs for execution)
    await app.run_worker_async(queues=["sums"])
```

There are quite a few interesting features that Procrastinate adds to the mix.
You can head to the Quickstart section for a general tour or
to the How-To sections for specific features. The Discussion
section should hopefully answer your questions. Otherwise,
feel free to open an [issue](https://github.com/procrastinate-org/procrastinate/issues).

*Note to my future self: add a quick note here on why this project is named*
"[Procrastinate]" ;) .

<!--Below this line is content that will appear in the GitHub Readme but not in the
Sphinx doc: end-of-index-doc -->

## Where to go from here

The complete [docs] is probably the best place to learn about the project.

If you encounter a bug, or want to get in touch, you're always welcome to open a
[ticket].

[docs]: https://procrastinate.readthedocs.io/
[procrastinate]: https://en.wikipedia.org/wiki/Procrastination
[quickstart]: https://procrastinate.readthedocs.io/en/stable/quickstart.html
[ticket]: https://github.com/procrastinate-org/procrastinate/issues/new


            

Raw data

            {
    "_id": null,
    "home_page": "https://procrastinate.readthedocs.io/",
    "name": "procrastinate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "postgres, task-queue",
    "author": "Joachim Jablon",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/78/7b/5f95bd0e50d4ed19def2f357302e4054a39af3e1c2dd5822f5221bed3660/procrastinate-2.2.0.tar.gz",
    "platform": null,
    "description": "# Procrastinate: PostgreSQL-based Task Queue for Python\n\n[![Deployed to PyPI](https://img.shields.io/pypi/v/procrastinate?logo=pypi&logoColor=white)](https://pypi.org/pypi/procrastinate)\n[![Deployed to PyPI](https://img.shields.io/pypi/pyversions/procrastinate?logo=pypi&logoColor=white)](https://pypi.org/pypi/procrastinate)\n[![GitHub Repository](https://img.shields.io/github/stars/procrastinate-org/procrastinate?style=flat&logo=github&color=brightgreen)](https://github.com/procrastinate-org/procrastinate/)\n[![Continuous Integration](https://img.shields.io/github/actions/workflow/status/procrastinate-org/procrastinate/ci.yml?logo=github&branch=main)](https://github.com/procrastinate-org/procrastinate/actions?workflow=CI)\n[![Documentation](https://img.shields.io/readthedocs/procrastinate/stable?logo=read-the-docs&logoColor=white)](https://procrastinate.readthedocs.io/en/stable/badge=stable)\n[![Documentation](https://img.shields.io/readthedocs/procrastinate/stable?logo=read-the-docs&logoColor=white)](https://procrastinate.readthedocs.io/en/stable/badge=stable)\n[![Coverage badge](https://raw.githubusercontent.com/procrastinate-org/procrastinate/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/procrastinate-org/procrastinate/blob/python-coverage-comment-action-data/htmlcov/index.html)\n[![MIT License](https://img.shields.io/github/license/procrastinate-org/procrastinate?logo=open-source-initiative&logoColor=white)](https://github.com/procrastinate-org/procrastinate/blob/main/LICENSE)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](https://github.com/procrastinate-org/procrastinate/blob/main/CODE_OF_CONDUCT.md)\n[![Discord](https://img.shields.io/discord/1197292025725329549?logo=discord&logoColor=white&label=Discord&color=%237289da)](https://discord.gg/JWZeNq6P6Z)\n\n**Procrastinate is looking for** [additional maintainers!](https://github.com/procrastinate-org/procrastinate/discussions/748)\n\nProcrastinate is an open-source Python 3.8+ distributed task processing\nlibrary, leveraging PostgreSQL to store task definitions, manage locks and\ndispatch tasks. It can be used within both sync and async code,\nhas [Django](howto/django/configuration) integration, and is easy to use with ASGI frameworks.\nIt supports periodic tasks, retries, arbitrary task locks etc.\n\nIn other words, from your main code, you call specific functions (tasks) in a\nspecial way and instead of being run on the spot, they're scheduled to\nbe run elsewhere, now or in the future.\n\nHere's an example (if you want to run the code yourself, head to [Quickstart]):\n\n```python\n# mycode.py\nimport procrastinate\n\n# Make an app in your code\napp = procrastinate.App(connector=procrastinate.SyncPsycopgConnector())\n\n# Then define tasks\n@app.task(queue=\"sums\")\ndef sum(a, b):\n    with open(\"myfile\", \"w\") as f:\n        f.write(str(a + b))\n\nwith app.open():\n    # Launch a job\n    sum.defer(a=3, b=5)\n\n# Somewhere in your program, run a worker (actually, it's usually a\n# different program than the one deferring jobs for execution)\napp.run_worker(queues=[\"sums\"])\n```\n\nThe worker will run the job, which will create a text file\nnamed `myfile` with the result of the sum `3 + 5` (that's `8`).\n\nSimilarly, from the command line:\n\n```bash\nexport PROCRASTINATE_APP=\"mycode.app\"\n\n# Launch a job\nprocrastinate defer mycode.sum '{\"a\": 3, \"b\": 5}'\n\n# Run a worker\nprocrastinate worker -q sums\n```\n\nLastly, you can use Procrastinate asynchronously too (actually, it's the\nrecommended way to use it):\n\n```python\nimport asyncio\n\nimport procrastinate\n\n# Make an app in your code\napp = procrastinate.App(connector=procrastinate.PsycopgConnector())\n\n# Define tasks using coroutine functions\n@app.task(queue=\"sums\")\nasync def sum(a, b):\n    await asyncio.sleep(a + b)\n\nasync with app.open_async():\n    # Launch a job\n    await sum.defer_async(a=3, b=5)\n\n    # Somewhere in your program, run a worker (actually, it's often a\n    # different program than the one deferring jobs for execution)\n    await app.run_worker_async(queues=[\"sums\"])\n```\n\nThere are quite a few interesting features that Procrastinate adds to the mix.\nYou can head to the Quickstart section for a general tour or\nto the How-To sections for specific features. The Discussion\nsection should hopefully answer your questions. Otherwise,\nfeel free to open an [issue](https://github.com/procrastinate-org/procrastinate/issues).\n\n*Note to my future self: add a quick note here on why this project is named*\n\"[Procrastinate]\" ;) .\n\n<!--Below this line is content that will appear in the GitHub Readme but not in the\nSphinx doc: end-of-index-doc -->\n\n## Where to go from here\n\nThe complete [docs] is probably the best place to learn about the project.\n\nIf you encounter a bug, or want to get in touch, you're always welcome to open a\n[ticket].\n\n[docs]: https://procrastinate.readthedocs.io/\n[procrastinate]: https://en.wikipedia.org/wiki/Procrastination\n[quickstart]: https://procrastinate.readthedocs.io/en/stable/quickstart.html\n[ticket]: https://github.com/procrastinate-org/procrastinate/issues/new\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Postgres-based distributed task processing library",
    "version": "2.2.0",
    "project_urls": {
        "Documentation": "https://procrastinate.readthedocs.io/",
        "Homepage": "https://procrastinate.readthedocs.io/",
        "Repository": "https://github.com/procrastinate-org/procrastinate/"
    },
    "split_keywords": [
        "postgres",
        " task-queue"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ad2d874b71befe5162972ef5bcdbbb7e4f1abdff2ddf2fe946f41c7cafe078e",
                "md5": "3a2069e846fd11864452ca96561a88f5",
                "sha256": "2477cda9faf68e58754494ff6ae675f34bfab565ee5f65f52472018f261361ea"
            },
            "downloads": -1,
            "filename": "procrastinate-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a2069e846fd11864452ca96561a88f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 101795,
            "upload_time": "2024-04-17T21:42:45",
            "upload_time_iso_8601": "2024-04-17T21:42:45.493994Z",
            "url": "https://files.pythonhosted.org/packages/5a/d2/d874b71befe5162972ef5bcdbbb7e4f1abdff2ddf2fe946f41c7cafe078e/procrastinate-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "787b5f95bd0e50d4ed19def2f357302e4054a39af3e1c2dd5822f5221bed3660",
                "md5": "63eea96c09022044de6699285c35e21f",
                "sha256": "69f2e5da7aba4458e0261ead3f5775209b04a0f5ef85c2b260cb4af285ae5a57"
            },
            "downloads": -1,
            "filename": "procrastinate-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "63eea96c09022044de6699285c35e21f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 71186,
            "upload_time": "2024-04-17T21:42:48",
            "upload_time_iso_8601": "2024-04-17T21:42:48.902293Z",
            "url": "https://files.pythonhosted.org/packages/78/7b/5f95bd0e50d4ed19def2f357302e4054a39af3e1c2dd5822f5221bed3660/procrastinate-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 21:42:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "procrastinate-org",
    "github_project": "procrastinate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "procrastinate"
}
        
Elapsed time: 0.23807s