ARQ Optimus
ARQ Optimus is a production-ready fork of ARQ (Async Redis Queue) with key-prefix isolation, cancellable jobs, and multi-project Redis support.
Why ARQ Optimus?
Stock ARQ uses hardcoded Redis key names (arq:queue, arq:job:*, etc.), which means multiple projects sharing the same Redis instance will collide. ARQ Optimus solves this with a configurable key_prefix that namespaces all Redis keys per project.
| Feature | Stock ARQ | ARQ Optimus |
|---|---|---|
| Key prefix isolation | ❌ | ✅ myproject:arq:queue |
| Multi-project Redis | ❌ | ✅ Safe sharing |
| Job tracking queues | ❌ | ✅ Running/completed/failed/cancelled |
| Cancellable jobs | Partial | ✅ Full support with status tracking |
| Drop-in compatible | — | ✅ Import path unchanged |
Installation
pip install arq-optimus
Quick Start
ARQ Optimus is a drop-in replacement for ARQ. Just change your install source — import paths stay the same:
# Before (stock arq)
# pip install arq
# After (arq-optimus)
# pip install arq-optimus
from arq import create_pool, Worker
from arq.connections import RedisSettings
Basic Usage (No Prefix)
Works exactly like stock ARQ — fully backward compatible:
import asyncio
from arq import create_pool
from arq.connections import RedisSettings
async def say_hello(ctx, name: str):
return f"Hello {name}!"
async def main():
pool = await create_pool(RedisSettings())
job = await pool.enqueue_job('say_hello', 'world')
result = await job.result()
print(result) # Hello world!
asyncio.run(main())
With Key Prefix (Multi-Project)
Namespace all Redis keys with a project prefix:
import asyncio
from arq import create_pool
from arq.connections import RedisSettings
async def main():
# All keys will be prefixed: scrape_optimus:arq:queue, scrape_optimus:arq:job:*, etc.
pool = await create_pool(RedisSettings(), key_prefix='scrape_optimus')
await pool.enqueue_job('my_task', 'arg1')
asyncio.run(main())
Worker with Key Prefix
from arq import Worker
from arq.connections import RedisSettings
async def my_task(ctx, arg):
return f"processed {arg}"
class WorkerSettings:
functions = [my_task]
redis_settings = RedisSettings()
key_prefix = 'scrape_optimus' # Must match the pool prefix!
Django Integration
Configure the prefix from Django settings:
# settings.py
PROJECT_NAME = 'my_project'
ARQ_OPTIMUS_KEY_PREFIX = PROJECT_NAME
# arq_worker.py
from django.conf import settings
from arq.connections import RedisSettings
class WorkerSettings:
functions = [...]
redis_settings = RedisSettings(host='localhost')
key_prefix = getattr(settings, 'ARQ_OPTIMUS_KEY_PREFIX', '')
Key Prefix Details
When key_prefix='myproject' is set, all Redis keys are namespaced:
| Default Key | Prefixed Key |
|---|---|
arq:queue |
myproject:arq:queue |
arq:job:<id> |
myproject:arq:job:<id> |
arq:result:<id> |
myproject:arq:result:<id> |
arq:in-progress:<id> |
myproject:arq:in-progress:<id> |
arq:abort |
myproject:arq:abort |
arq:track:running |
myproject:arq:track:running |
arq:track:completed |
myproject:arq:track:completed |
arq:track:failed |
myproject:arq:track:failed |
CLI
Run your worker with the standard arq command:
arq my_worker.WorkerSettings
Dashboard & Job Management CLI
For a real-time monitoring dashboard and a job management CLI, install the companion package:
pip install arq-optimus-dashboard
See arq-optimus-dashboard on PyPI for details.
Compatibility
- Python: 3.9+
- Redis: 5, 6, 7+
- Drop-in replacement: Same import paths as stock ARQ (
from arq import ...)
Credits
Based on ARQ by Samuel Colvin. Extended with key-prefix isolation, job tracking, and multi-project support by Arpan Sahu.
License
MIT License — see LICENSE for details.
Metadata
Release files for arq-optimus 0.27.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| arq_optimus-0.27.0.tar.gz | 500.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arq_optimus-0.27.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 529.0 kB
Release files / arq_optimus-0.27.0.tar.gz
| Download URL | arq_optimus-0.27.0.tar.gz |
|---|---|
| Size | 500.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a96734ef1ed9a4a8d976d00c6f9b906da003c02f256abe2984bd512aeb400160
|
|
BLAKE2b-256 checksum How to use checksums |
bf3bd0be3a6253258ec86f06d3f5e29fe96cd676daca00a07bb144353b436dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.7
|
Release files / arq_optimus-0.27.0-py3-none-any.whl
| Download URL | arq_optimus-0.27.0-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4d8ecc55696e1d889487e211afaa4e2d76dcdfcaaa613675fe4d204deb4cdb9
|
|
BLAKE2b-256 checksum How to use checksums |
0056858870ba08b055e44ae2ee25b77fc4a22678707929f72184638aeb78bb70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.7
|
Security for arq-optimus 0.27.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.