Skip to main content

Oban logo

Oban is a sophisticated job orchestration framework for Python, backed by PostgreSQL. Reliable,
observable, and loaded with enterprise grade features.

PyPI Version CI Status Apache 2 License

Table of Contents



Features

Oban's primary goals are reliability, consistency and observability.

Oban is a powerful and flexible library that can handle a wide range of background job use cases, and it is well-suited for systems of any size. It provides a simple and consistent API for scheduling and performing jobs, and it is built to be fault-tolerant and easy to monitor.

Oban is fundamentally different from other background job processing tools because it retains job data for historic metrics and inspection. You can leave your application running indefinitely without worrying about jobs being lost or orphaned due to crashes.

Advantages Over Other Tools

  • Async Native — Built entirely on asyncio with async/await throughout. Integrates naturally with async web frameworks.

  • Fewer Dependencies — If you are running a web app there is a very good chance that you're running on top of a SQL database. Running your job queue within a SQL database minimizes system dependencies and simplifies data backups.

  • Transactional Control — Enqueue a job along with other database changes, ensuring that everything is committed or rolled back atomically.

  • Database Backups — Jobs are stored inside of your primary database, which means they are backed up together with the data that they relate to.

Advanced Features

  • Isolated Queues — Jobs are stored in a single table but are executed in distinct queues. Each queue runs in isolation, with its own concurrency limits, ensuring that a job in a single slow queue can't back up other faster queues.

  • Queue Control — Queues can be started, stopped, paused, resumed and scaled independently at runtime locally or across all running nodes.

  • Resilient Queues — Failing queries won't crash the entire process, instead a backoff mechanism will safely retry them again in the future.

  • Multi-Process Execution — Bypass the GIL and utilize multiple cores for CPU-intensive workloads. Jobs are distributed across worker processes with oban start --processes.

  • Job Canceling — Jobs can be canceled regardless of which node they are running on. For executing jobs, workers can check for cancellation at safe points and stop gracefully.

  • Triggered Execution — Insert triggers ensure that jobs are dispatched on all connected nodes as soon as they are inserted into the database.

  • Unique Jobs — Duplicate work can be avoided through unique job controls. Uniqueness can be enforced at the argument, queue, worker and even sub-argument level for any period of time.

  • Scheduled Jobs — Jobs can be scheduled at any time in the future, down to the second.

  • Periodic (CRON) Jobs — Automatically enqueue jobs on a cron-like schedule. Duplicate jobs are never enqueued, no matter how many nodes you're running.

  • Job Priority — Prioritize jobs within a queue to run ahead of others with ten levels of granularity.

  • Historic Metrics — After a job is processed the row isn't deleted. Instead, the job is retained in the database to provide metrics. This allows users to inspect historic jobs and to see aggregate data at the job, queue or argument level.

  • Node Metrics — Every queue records metrics to the database during runtime. These are used to monitor queue health across nodes and may be used for analytics.

  • Graceful Shutdown — Queue shutdown is delayed so that slow jobs can finish executing before shutdown. When shutdown starts queues are paused and stop executing new jobs. Any jobs left running after the shutdown grace period may be rescued later.

  • Recorded Results — Return a Record from a worker to store its result on the job for later retrieval.

  • Testing Helpers — Run jobs inline or manually during tests, assert on enqueued jobs, and drain queues on demand.

  • Telemetry Integration — Job and queue life-cycle events are emitted through oban.telemetry. This enables simple logging, error reporting and health checkups without plug-ins.

  • Web Dashboard — Monitor queues, inspect jobs, and view execution metrics through Oban Web. Run the standalone dashboard via Docker for a complete overview of your job processing system.

🌟 Oban Pro

Oban Pro is a licensed add-on that expands what Oban is capable of while making complex workflows possible.

  • Drop-In Optimizations — Switch to Pro for automatic bulk inserts, bulk acking, accurate orphan rescue, and constraint-backed unique jobs, with no code changes required.

  • Erlang Notifier — Replace Postgres pub/sub with direct communication between processes. Works through transaction poolers, without a payload size limit, and keeps notifications out of the database.

  • Smart Concurrency — Global limits across all nodes, rate limiting (e.g., 60 jobs/minute), and partitioned queues that apply limits per worker, tenant, or any argument.

  • Pro Pruner — Fine-grained retention rules per queue, worker, or state. Prune on a cron schedule, manage rules at runtime, and archive jobs rather than deleting them.

  • Relay — Dispatch jobs and await their results with synchronous-style semantics, even when jobs execute on different servers.

  • Awaiting Signals — Pause a job mid-execution to wait for an external decision, then resume when a signal arrives. Ideal for approval flows and third-party callbacks.

  • Durable Workflows — Compose jobs with dependencies for sequential, fan-out, and fan-in patterns. Sub-workflows, result sharing, cascading functions, and runtime grafting for dynamic pipelines.

  • Chunks — Process jobs together in groups by size or wait time, e.g. 1,000 jobs or every 10 seconds, and apply outcomes to individual jobs.

Learn more about Oban Pro →

Requirements

Oban requires:

  • Python 3.12+
  • PostgreSQL 14.0+

Installation

See the installation guide for details on installing and configuring Oban for your application.

Quick Start

Get up and running in just a few steps: define a worker (or decorate a function), start processing with the CLI (or embedded mode), and enqueue jobs.

  1. Define a worker to process jobs:

    from oban import worker
    
    
    @worker(queue="exports", max_attempts=5)
    class ExportWorker:
        async def process(self, job):
            report = await generate_report(job.args["report_id"])
    
            await send_to_user(job.args["email"], report)
    
  2. Run with the CLI:

    # Install the database schema (once)
    oban install --dsn postgresql://localhost/mydb
    
    # Start processing jobs
    oban start --dsn postgresql://localhost/mydb --queues exports:10
    

    Or embed in your application (FastAPI, Django, etc.):

    from oban import Oban
    
    oban = Oban(pool=pool, queues={"exports": 10})
    
    async with oban:
        ...  # Run your app
    
  3. Enqueue jobs from anywhere in your app:

    # Enqueue one job
    await ExportWorker.enqueue({"report_id": 123, "email": "user@example.com"})
    
    # Or many jobs at once
    await oban.enqueue_many(
        ExportWorker.new({"report_id": report_id, "email": "user@example.com"})
        for report_id in [1, 2, 3]
    )
    

For more details, see the full documentation.

Also Available

Oban for Elixir — The original Oban, with support for PostgreSQL, MySQL, and SQLite3

Oban for Python and Elixir are fully compatible — they share the same database schema and can run side-by-side, making it easy to use both languages in the same system.

Community

Submit bug reports and upcoming features in the issue tracker

Contributing

To run the Oban test suite you must have Python 3.12+, PostgreSQL 14+, and uv installed. Follow these steps to create the database and run all tests:

make test

To ensure a commit passes CI you should run make ci, or run these checks locally:

  • Lint with Ruff (uv run ruff check)
  • Check formatting (uv run ruff format --check)
  • Check types (uv run ty check)
  • Run tests (uv run pytest)

Building Documentation

There are make commands available to help build and serve the documentation locally:

# Build HTML documentation
make docs

# Build and serve at http://localhost:8000
make docs-serve

# Clean built documentation
make docs-clean

Metadata

Release files for oban 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oban 0.8.0
File Size Uploaded Provenance Actions
oban-0.8.0.tar.gz 84.2 kB Without provenance Details for oban-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oban 0.8.0
File Interpreter ABI Platform Actions
oban-0.8.0-py3-none-any.whl Python 3 none any Details for oban-0.8.0-py3-none-any.whl

Total release size: 181.2 kB

Release files / oban-0.8.0.tar.gz

Download URL oban-0.8.0.tar.gz
Size 84.2 kB
Tags Source
SHA-256 checksum
How to use checksums
abffad96dd43d6c5f2b7c02f530bb7170401d84626a99fefaa811cb65eba9f2f
BLAKE2b-256 checksum
How to use checksums
28f836524a916cdb468d6b18fde706a564ad97aa263d82d6ebac7ef3e8a70538
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / oban-0.8.0-py3-none-any.whl

Download URL oban-0.8.0-py3-none-any.whl
Size 97.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f987a734f13ef3ff39c277d937d83a6517b90010794f7e1dc31a96afcbd5dad4
BLAKE2b-256 checksum
How to use checksums
3a0f193974070269120115e9e625dca732e89bf469347d5a0c450b3cbe45b4e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for oban 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page