How procrastinate-org/procrastinate works
Procrastinate is a Python task queue backed by PostgreSQL. Applications register tasks, defer jobs for immediate or scheduled execution, and workers fetch and execute them while persisting job status. The runtime also supports retries, periodic scheduling, middleware, and Django integration. The graph follows the documented workflow and SOURCE INDEX references; where implementation excerpts were unavailable, it omits uncertain relationships rather than inferring calls.
Main entry points: worker.py Worker · manager.py Job manager · app.py Application · tasks.py Task API
Components 19
Task Definition
- Application
procrastinate/app.py - Task registry
procrastinate/blueprints.py - Task API
procrastinate/tasks.py - Job model
procrastinate/jobs.py
Job Execution
- Worker
procrastinate/worker.py - Job context
procrastinate/job_context.py - Task middleware
procrastinate/middleware.py - Retry policy
procrastinate/retry.py - Periodic scheduling
procrastinate/periodic.py
Queue Persistence
- Job manager
procrastinate/manager.py - Connector interface
procrastinate/connector.py - SQL queries
procrastinate/sql/__init__.py - PostgreSQL
Interfaces & Integrations
- Command line
procrastinate/cli.py - Django integration
procrastinate/contrib/django/django_connector.py - Django settings
procrastinate/contrib/django/settings.py - Sync PostgreSQL
procrastinate/sync_psycopg_connector.py - Async PostgreSQL
procrastinate/psycopg_connector.py
Other components
- Application code
Connections 21
- Application code → Application: configures
- Application → Task registry: registers tasks
procrastinate/app.py - Task registry → Task API: creates tasks
procrastinate/blueprints.py - Application code → Task API: defers jobs
- Task API → Job model: configures jobs
procrastinate/tasks.py - Task API → Job manager: submits jobs
procrastinate/tasks.py - Application → Worker: starts worker
procrastinate/app.py - Worker → Job manager: fetches and updates
procrastinate/worker.py - Worker → Job context: builds context
procrastinate/worker.py - Worker → Task middleware: composes middleware
procrastinate/worker.py - Worker → Retry policy: uses retry policy
procrastinate/worker.py - Worker → Periodic scheduling: runs periodic deferrer
procrastinate/worker.py - Job manager → Connector interface: executes queries
procrastinate/manager.py - Job manager → SQL queries: uses queries
procrastinate/manager.py - Connector interface → PostgreSQL: accesses database
- Command line → Job manager: manages jobs
procrastinate/cli.py - Django integration → Sync PostgreSQL: adapts connector
procrastinate/contrib/django/django_connector.py - Django integration → Async PostgreSQL: adapts connector
procrastinate/contrib/django/django_connector.py - Django settings → Application: configures
procrastinate/contrib/django/settings.py - Sync PostgreSQL → Connector interface: implements interface
procrastinate/sync_psycopg_connector.py - Async PostgreSQL → Connector interface: implements interface
procrastinate/psycopg_connector.py