procrastinate


Nameprocrastinate JSON
Version 2.15.0 PyPI version JSON
download
home_pagehttps://procrastinate.readthedocs.io/
SummaryPostgres-based distributed task processing library
upload_time2024-10-19 11:50:11
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)
[![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/d6/90/dbdc69c1178ce523bc260cb7d356170c632be3809e4c1f7201f06213a75d/procrastinate-2.15.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[![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.15.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": "c0e80fbf97ceebfdb010bac6d12a91ff269e6d0efffd671d05efde95d6d6d711",
                "md5": "e88cdd8c383987132e6bceafb1545da2",
                "sha256": "7e2f0980ac1e1a9bda4fdc6e9580f89029844f1691602142a1e533ef5eb3c8cd"
            },
            "downloads": -1,
            "filename": "procrastinate-2.15.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e88cdd8c383987132e6bceafb1545da2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 124540,
            "upload_time": "2024-10-19T11:50:09",
            "upload_time_iso_8601": "2024-10-19T11:50:09.991587Z",
            "url": "https://files.pythonhosted.org/packages/c0/e8/0fbf97ceebfdb010bac6d12a91ff269e6d0efffd671d05efde95d6d6d711/procrastinate-2.15.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d690dbdc69c1178ce523bc260cb7d356170c632be3809e4c1f7201f06213a75d",
                "md5": "731dcd47add9ec3a0e976959697bffdf",
                "sha256": "b75d2361e0210bffbad9394f8b7ef9486a366f2a8b50590b23e6952d673228b0"
            },
            "downloads": -1,
            "filename": "procrastinate-2.15.0.tar.gz",
            "has_sig": false,
            "md5_digest": "731dcd47add9ec3a0e976959697bffdf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 77474,
            "upload_time": "2024-10-19T11:50:11",
            "upload_time_iso_8601": "2024-10-19T11:50:11.160315Z",
            "url": "https://files.pythonhosted.org/packages/d6/90/dbdc69c1178ce523bc260cb7d356170c632be3809e4c1f7201f06213a75d/procrastinate-2.15.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-19 11:50:11",
    "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.31859s