Procrastinate is an open-source Python 3.10+ distributed task processing library that leverages PostgreSQL 13+ to store task definitions, manage locks, and dispatch tasks. It integrates with both synchronous and asynchronous code, offers Django integration, and is compatible with ASGI frameworks, supporting features like periodic tasks, retries, and arbitrary task locks.
pip install procrastinate psycopg[binary]Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a Procrastinate application, declare a task, and defer a job. It assumes a PostgreSQL database is running and accessible via `POSTGRES_DSN`. To run the worker that executes deferred tasks, a separate CLI command is provided.
Review the official 'Migration documentation' for your specific version upgrade. Apply 'pre' migrations before deployment and 'post' migrations after.
Upgrade your Python environment to version 3.10 or later. Check the official documentation for the latest supported Python versions.
Explicitly list all modules containing task definitions in the `import_paths` parameter when initializing your `App` instance, or ensure they are imported as a side effect when the `App` is instantiated.
Understand the implications of async/sync boundaries. For synchronous task functions, be aware they run in a thread pool. For I/O-bound tasks, this is often fine. For CPU-bound tasks, consider making them `async` if possible or using other multiprocessing approaches if true parallelism is needed.