RRQ is a library for creating reliable job queues using Rust, Redis. with language-agnostic producers and workers.
Project description
RRQ: Reliable Redis Queue
RRQ is a Redis-backed job queue system with a Rust orchestrator and a language-agnostic runner protocol. Producers can enqueue jobs from Python, Rust, or any language that can write the job schema to Redis. Runners can be written in any language that can speak the socket protocol.
This Python package (rrq) provides the producer SDK plus the Python runner
runtime. The Rust components are published as crates and are typically used to
run the orchestrator or build native producers/runners.
Project Components
- Python package (this): producer SDK, Python runner runtime, OpenTelemetry runner integration.
- Rust orchestrator (
rrqcrate): scheduling, retries, timeouts, DLQ, cron. - Rust producer (
rrq-producercrate): native producer for Rust apps. - Rust runner (
rrq-runnercrate): runner runtime + example.
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 │
└──────────┬───────────────────┘
│ TCP socket protocol
│ (request <-> outcome)
▼
┌─────────────────────┬─────────────────────┐
│ Python Runner │ Rust/Other Runner │
│ (rrq-runner) │ (rrq-runner) │
└───────────────────────────────────────────┘
Runners return outcomes to the orchestrator; the orchestrator persists job state/results back to Redis.
Requirements
- Python 3.11+ (producer + Python runner runtime)
- Rust
rrqbinary (orchestrator CLI; bundled in wheels or provided separately) - Redis 5.0+
If you ship the Rust binary separately, set RRQ_RUST_BIN to its path.
FFI producer library (local dev/tests)
The Python producer uses the Rust rrq-producer shared library. For local
tests from the repo, use the helper script to build the library and set
RRQ_PRODUCER_LIB_PATH automatically:
sh scripts/with-producer-lib.sh -- sh -c "cd rrq-py && uv run pytest"
Published wheels include rrq/bin/librrq_producer.* so no extra setup is
required in production unless you want to override the library path.
Quickstart
1) Install
uv pip install rrq
2) Create rrq.toml
[rrq]
redis_dsn = "redis://localhost:6379/1"
default_runner_name = "python"
[rrq.runners.python]
type = "socket"
cmd = ["rrq-runner", "--settings", "myapp.runner_config.python_runner_settings"]
# Required: localhost TCP socket (host:port). For pool_size > 1, ports increment.
tcp_socket = "127.0.0.1:9000"
3) Register Python handlers
# runner_config.py
from rrq.runner_settings import PythonRunnerSettings
from rrq.registry import Registry
from . import handlers
registry = Registry()
registry.register("process_message", handlers.process_message)
python_runner_settings = PythonRunnerSettings(
registry=registry,
)
4) Run the Python runner
rrq-runner --settings myapp.runner_config.python_runner_settings
5) Run the Rust orchestrator
rrq worker run --config rrq.toml
6) Enqueue jobs (Python)
import asyncio
from rrq.client import RRQClient
async def main():
client = RRQClient(config_path="rrq.toml")
await client.enqueue("process_message", {"args": ["hello"]})
await client.close()
asyncio.run(main())
Job status + results
status = await client.get_job_status(job_id)
OpenTelemetry (runner)
from rrq.integrations import otel
otel.enable(service_name="my-runner")
See docs/TELEMETRY.md for end-to-end tracing from producer → runner.
Configuration
rrq.toml is the source of truth for the orchestrator and runners. Key areas:
[rrq]basic settings (Redis, retries, timeouts, poll delay)[rrq.runners.<name>]runner commands, pool sizes, andmax_in_flight[rrq.runner_routes]queue → runner mapping (legacy[rrq.routing]still accepted)[[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/RUNNER_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 watchrrq checkrrq queue list|stats|inspectrrq job show|list|trace|replay|cancelrrq dlq list|stats|inspect|requeuerrq 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 runners, and starts a fresh worker. Watch
mode is intended for local development; runner 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
Runner Logs
Runners can emit logs to stdout/stderr. The orchestrator captures these lines and emits them with runner prefixes. Structured logging is not part of the wire protocol.
Testing
Runtime-only Python tests (producer + runner + store):
cd rrq-py
uv run pytest
End-to-end integration (Python-only, Rust-only, mixed):
cd rrq-py
uv run python ../examples/integration_test.py
Reference Implementations
- Rust orchestrator (crate
rrq):rrq-rs/orchestrator - Rust producer:
rrq-rs/producer - Rust runner:
rrq-rs/runner - Protocol types:
rrq-rs/protocol - Python runner examples:
examples/python/
Telemetry
Optional tracing integrations are available for Python producers and the Python
runner runtime. See rrq/integrations/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rrq-0.9.9-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: rrq-0.9.9-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e044945da32f79ea2fa3ed8a440cbd86b76e72fc2fe76d1fb1a89b06e9140bd
|
|
| MD5 |
0ba52e318ec19a65c675b28a5c622785
|
|
| BLAKE2b-256 |
c604709962a4fc3b2ea2229a572c23dab9e4dd71febe9124e5dc19b32c011f67
|
Provenance
The following attestation bundles were made for rrq-0.9.9-py3-none-manylinux_2_35_x86_64.whl:
Publisher:
build-wheels.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.9-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
4e044945da32f79ea2fa3ed8a440cbd86b76e72fc2fe76d1fb1a89b06e9140bd - Sigstore transparency entry: 885832035
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Branch / Tag:
refs/tags/v0.9.9 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file rrq-0.9.9-py3-none-manylinux_2_35_aarch64.whl.
File metadata
- Download URL: rrq-0.9.9-py3-none-manylinux_2_35_aarch64.whl
- Upload date:
- Size: 6.2 MB
- Tags: Python 3, manylinux: glibc 2.35+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63556c12e8e0428c5d15c0543674cdfa782ebd4823045363de85e2b383439725
|
|
| MD5 |
fb98ed4dab8f170e3c57cf097df804f2
|
|
| BLAKE2b-256 |
3565ff1c349ce69bf59fc2c60484375e178354b3b5a189627f992b155fa5fabd
|
Provenance
The following attestation bundles were made for rrq-0.9.9-py3-none-manylinux_2_35_aarch64.whl:
Publisher:
build-wheels.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.9-py3-none-manylinux_2_35_aarch64.whl -
Subject digest:
63556c12e8e0428c5d15c0543674cdfa782ebd4823045363de85e2b383439725 - Sigstore transparency entry: 885832077
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Branch / Tag:
refs/tags/v0.9.9 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file rrq-0.9.9-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: rrq-0.9.9-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.7 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0b6f0f1f377233c493bcf7414293d02d9c767304204b7e23c2fc1f097b0ca2b
|
|
| MD5 |
fb525f5eead91eccda508e4ad105646e
|
|
| BLAKE2b-256 |
9b42d88ed40c8b4de7f985e085401834d41474cd796a100eb3f334f070e2b4dd
|
Provenance
The following attestation bundles were made for rrq-0.9.9-py3-none-macosx_11_0_arm64.whl:
Publisher:
build-wheels.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.9-py3-none-macosx_11_0_arm64.whl -
Subject digest:
f0b6f0f1f377233c493bcf7414293d02d9c767304204b7e23c2fc1f097b0ca2b - Sigstore transparency entry: 885831987
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Branch / Tag:
refs/tags/v0.9.9 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-wheels.yml@c5d67b59ef06510b3bc85f72e5dca3a33e6878ee -
Trigger Event:
push
-
Statement type: