Skip to main content

RRQ is a library for creating reliable job queues using Rust, Redis. with language-agnostic producers and workers.

Reason this release was yanked:

TLS Broken

Project description

RRQ: Reliable Redis Queue

RRQ is a Redis-backed job queue system with a Rust orchestrator and a language-agnostic executor protocol. Producers can enqueue jobs from Python, Rust, or any language that can write the job schema to Redis. Executors can be written in any language that can speak the socket protocol. The orchestrator is implemented in Rust, with executors available in multiple languages.

At a Glance

  • Rust orchestrator: schedules, retries, timeouts, DLQ, cron.
  • Unix socket executors: Python, Rust, or any other runtime.
  • Python SDK: enqueue jobs and run a Python executor runtime.

Architecture

┌──────────────────────────────┐
│        Producers SDKs        │
│  (Python, Rust, other langs) │
└───────────────┬──────────────┘
                │ enqueue jobs
                ▼
      ┌───────────────────────┐
      │         Redis         │
      │  - queues (ZSETs)     │
      │  - job hashes         │
      │  - locks              │
      │  - DLQ lists          │
      └──────────┬────────────┘
                 │ poll/lock
                 ▼
      ┌──────────────────────────────┐
      │   Rust RRQ Orchestrator      │
      │     (rrq worker run)         │
      │ - scheduling + retries       │
      │ - timeouts + DLQ             │
      │ - queue routing              │
      │ - cron jobs                  │
      └──────────┬───────────────────┘
                 │ Unix socket protocol
                 │ (request <-> outcome)
                 ▼
   ┌─────────────────────┬─────────────────────┐
   │ Python Executor     │ Rust/Other Executor │
   │ (rrq-executor)      │ (rrq-executor)      │
   └───────────────────────────────────────────┘

Executors return outcomes to the orchestrator; the orchestrator persists job state/results back to Redis.

Requirements

  • Python 3.11+ (producer + Python executor runtime)
  • Rust rrq binary (bundled in wheels or provided separately)
  • Redis 5.0+

If you ship the Rust binary separately, set RRQ_RUST_BIN to its path.

Quickstart

1) Install

uv pip install rrq

2) Create rrq.toml

[rrq]
redis_dsn = "redis://localhost:6379/1"
default_executor_name = "python"

[rrq.executors.python]
type = "socket"
cmd = ["rrq-executor", "--settings", "myapp.executor_config.python_executor_settings"]
# Optional: override the directory used for executor sockets.
# socket_dir = "/tmp/rrq-executor"
# Optional: use a localhost TCP socket instead of Unix sockets (pool_size must be 1).
# tcp_socket = "127.0.0.1:9000"

3) Register Python handlers

# executor_config.py
from rrq.config import load_toml_settings
from rrq.executor_settings import PythonExecutorSettings
from rrq.registry import JobRegistry

from . import handlers

job_registry = JobRegistry()
job_registry.register("process_message", handlers.process_message)

rrq_settings = load_toml_settings("rrq.toml")

python_executor_settings = PythonExecutorSettings(
    rrq_settings=rrq_settings,
    job_registry=job_registry,
)

4) Run the Python executor

rrq-executor --settings myapp.executor_config.python_executor_settings

5) Run the Rust orchestrator

rrq worker run --config rrq.toml

6) Enqueue jobs (Python)

import asyncio
from rrq.client import RRQClient
from rrq.config import load_toml_settings

async def main():
    settings = load_toml_settings("rrq.toml")
    client = RRQClient(settings=settings)
    await client.enqueue("process_message", "hello")
    await client.close()

asyncio.run(main())

Configuration

rrq.toml is the source of truth for the orchestrator and executors. Key areas:

  • [rrq] basic settings (Redis, retries, timeouts, poll delay)
  • [rrq.executors.<name>] socket executor commands, pool sizes, and max_in_flight
  • [rrq.routing] queue → executor mapping
  • [[rrq.cron_jobs]] periodic scheduling
  • [rrq.watch] watch mode defaults (path/patterns)

See docs/CONFIG_REFERENCE.md for the full TOML schema, docs/CLI_REFERENCE.md for CLI details, and docs/EXECUTOR_PROTOCOL.md for wire format.

Cron Jobs (rrq.toml)

Use [[rrq.cron_jobs]] entries to enqueue periodic jobs while a worker is running. Schedules are evaluated in UTC.

[[rrq.cron_jobs]]
function_name = "process_message"
schedule = "0 * * * * *"
args = ["cron payload"]
kwargs = { source = "cron" }
queue_name = "default"
unique = true

Fields:

  • function_name (required): Handler name to enqueue.
  • schedule (required): Cron expression with seconds (6-field format).
  • args / kwargs: Optional arguments passed to the handler.
  • queue_name: Optional override for the target queue.
  • unique: Optional; uses a per-function unique lock to prevent duplicates.

CLI Overview (Rust rrq)

  • rrq worker run, rrq worker watch
  • rrq check
  • rrq queue list|stats|inspect
  • rrq job show|list|trace|replay|cancel
  • rrq dlq list|stats|inspect|requeue
  • rrq debug generate-jobs|generate-workers|submit|clear|stress-test

Worker Watch Mode

rrq worker watch runs a normal worker loop plus a filesystem watcher. It watches a path recursively and normalizes change paths before matching include globs (default *.py, *.toml) and ignore globs. A matching change triggers a graceful worker shutdown, closes executors, and starts a fresh worker. Watch mode is intended for local development; executor pool sizes and max_in_flight are forced to 1 to keep restarts lightweight. It also respects .gitignore and .git/info/exclude by default; disable with --no-gitignore.

You can also configure watch defaults in rrq.toml:

[rrq.watch]
path = "."
include_patterns = ["*.py", "*.toml"]
ignore_patterns = [".venv/**", "dist/**"]
no_gitignore = false

Executor Logs

Executors can emit logs to stdout/stderr. The orchestrator captures these lines and emits them with executor prefixes. Structured logging is not part of the wire protocol.

Testing

Runtime-only Python tests (producer + executor + store):

uv run pytest

End-to-end integration (Python-only, Rust-only, mixed):

uv run python -m examples.integration_test

Reference Implementations

  • Rust orchestrator (crate rrq): rrq-rs/rrq-orchestrator
  • Rust producer: rrq-rs/rrq-producer
  • Rust executor: rrq-rs/rrq-executor
  • Protocol types: rrq-rs/rrq-protocol
  • Python socket executor example: reference/python/socket_executor.py

Telemetry

Optional tracing integrations are available for Python producers and the Python executor runtime. See rrq/integrations/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rrq-0.9.3.tar.gz (32.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rrq-0.9.3-py3-none-manylinux_2_35_x86_64.whl (3.9 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

rrq-0.9.3-py3-none-manylinux_2_35_aarch64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ ARM64

rrq-0.9.3-py3-none-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file rrq-0.9.3.tar.gz.

File metadata

  • Download URL: rrq-0.9.3.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for rrq-0.9.3.tar.gz
Algorithm Hash digest
SHA256 2c6ac46073f4566810ba687380dc19efd26aa9dfaaab6d17a1241041c0b711ab
MD5 a11297d77655a4d712c1b07764e6d7f0
BLAKE2b-256 5c9f070dfb5de4206c8c3d666d8bc9a4a98236f43a7af1f473bb719d75c4fc90

See more details on using hashes here.

File details

Details for the file rrq-0.9.3-py3-none-manylinux_2_35_x86_64.whl.

File metadata

  • Download URL: rrq-0.9.3-py3-none-manylinux_2_35_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: Python 3, manylinux: glibc 2.35+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for rrq-0.9.3-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 22ed4a3f80b9022475f54e3855da688edabb634705033bce99d46f5e97363fee
MD5 c940b1dc38ca2c7038171c4a374bb0f8
BLAKE2b-256 2bf871d6c0552afc4eea7626673bb5ec567b4aaf64df8f019c7599b837a18b2e

See more details on using hashes here.

File details

Details for the file rrq-0.9.3-py3-none-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for rrq-0.9.3-py3-none-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 2cf3b720f02db9068b10d9ac3441a54c2eec95970f978a3452a284b97ddbe4fd
MD5 e3275cec69b7bc91833cf54b5ae13ea2
BLAKE2b-256 606f1507a02ec9b605cdf83d81ae101afdbe094bc07263413f40e72e1a218975

See more details on using hashes here.

File details

Details for the file rrq-0.9.3-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: rrq-0.9.3-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for rrq-0.9.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b29c8562cf69f9bcb29702bffbff00c9928a2c3ba9a7952d614f638507f2907
MD5 162e521a0b56efc869e5b780bc2ec15f
BLAKE2b-256 4d5ace2493dd52a8ff011fdb34241930085a70ef6ed979cb7881c72b58b571f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page