rrq 0.8.1__py3-none-macosx_15_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rrq/bin/README.md +4 -0
- rrq-0.8.1.dist-info/METADATA +254 -0
- rrq-0.8.1.dist-info/RECORD +6 -0
- rrq-0.8.1.dist-info/WHEEL +4 -0
- rrq-0.8.1.dist-info/entry_points.txt +3 -0
- rrq-0.8.1.dist-info/licenses/LICENSE +13 -0
rrq/bin/README.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rrq
|
|
3
|
+
Version: 0.8.1
|
|
4
|
+
Summary: RRQ is a Python library for creating reliable job queues using Redis and asyncio
|
|
5
|
+
Project-URL: Homepage, https://github.com/getresq/rrq
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/getresq/rrq/issues
|
|
7
|
+
Author-email: Mazdak Rezvani <mazdak@me.com>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
17
|
+
Classifier: Topic :: System :: Monitoring
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: pydantic>=2.11.4
|
|
20
|
+
Requires-Dist: redis[hiredis]>=4.2.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest-asyncio>=1.0.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest>=8.3.5; extra == 'dev'
|
|
25
|
+
Requires-Dist: ruff==0.14.9; extra == 'dev'
|
|
26
|
+
Requires-Dist: ty==0.0.1-alpha.26; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# RRQ: Reliable Redis Queue
|
|
30
|
+
|
|
31
|
+
RRQ is a Redis-backed job queue **system** with a Rust orchestrator and a
|
|
32
|
+
language-agnostic executor protocol. Producers can enqueue jobs from Python,
|
|
33
|
+
Rust, or any language that can write the job schema to Redis. Executors can be
|
|
34
|
+
written in any language that can speak the stdio protocol. Python remains a
|
|
35
|
+
first-class runtime for producers and executors; orchestration is Rust-first.
|
|
36
|
+
|
|
37
|
+
## At a Glance
|
|
38
|
+
|
|
39
|
+
- **Rust orchestrator**: schedules, retries, timeouts, DLQ, cron.
|
|
40
|
+
- **Stdio executors**: Python, Rust, or any other runtime.
|
|
41
|
+
- **Python SDK**: enqueue jobs and run a Python executor runtime.
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
┌──────────────────────────────┐
|
|
47
|
+
│ Producers SDKs │
|
|
48
|
+
│ (Python, Rust, other langs) │
|
|
49
|
+
└───────────────┬──────────────┘
|
|
50
|
+
│ enqueue jobs
|
|
51
|
+
▼
|
|
52
|
+
┌───────────────────────┐
|
|
53
|
+
│ Redis │
|
|
54
|
+
│ - queues (ZSETs) │
|
|
55
|
+
│ - job hashes │
|
|
56
|
+
│ - locks │
|
|
57
|
+
│ - DLQ list │
|
|
58
|
+
└──────────┬────────────┘
|
|
59
|
+
│ poll/lock
|
|
60
|
+
▼
|
|
61
|
+
┌──────────────────────────────┐
|
|
62
|
+
│ Rust RRQ Orchestrator │
|
|
63
|
+
│ (rrq worker run) │
|
|
64
|
+
│ - scheduling + retries │
|
|
65
|
+
│ - timeouts + DLQ │
|
|
66
|
+
│ - queue routing │
|
|
67
|
+
│ - cron jobs │
|
|
68
|
+
└──────────┬───────────────────┘
|
|
69
|
+
│ stdio JSONL protocol
|
|
70
|
+
▼
|
|
71
|
+
┌─────────────────────┬─────────────────────┐
|
|
72
|
+
│ Python Executor │ Rust/Other Executor │
|
|
73
|
+
│ (rrq-executor) │ (rrq-executor) │
|
|
74
|
+
└─────────┬───────────┴─────────┬───────────┘
|
|
75
|
+
│ ExecutionOutcome │
|
|
76
|
+
└──────────┬──────────┘
|
|
77
|
+
▼
|
|
78
|
+
┌─────────────┐
|
|
79
|
+
│ Redis │
|
|
80
|
+
│ job updates │
|
|
81
|
+
└─────────────┘
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Requirements
|
|
85
|
+
|
|
86
|
+
- Python 3.11+ (producer + Python executor runtime)
|
|
87
|
+
- Rust `rrq` binary (bundled in wheels or provided separately)
|
|
88
|
+
- Redis 5.0+
|
|
89
|
+
|
|
90
|
+
If you ship the Rust binary separately, set `RRQ_RUST_BIN` to its path.
|
|
91
|
+
|
|
92
|
+
## Quickstart
|
|
93
|
+
|
|
94
|
+
### 1) Install
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
uv pip install rrq
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 2) Create `rrq.toml`
|
|
101
|
+
|
|
102
|
+
```toml
|
|
103
|
+
[rrq]
|
|
104
|
+
redis_dsn = "redis://localhost:6379/1"
|
|
105
|
+
default_executor_name = "python"
|
|
106
|
+
|
|
107
|
+
[rrq.executors.python]
|
|
108
|
+
type = "stdio"
|
|
109
|
+
cmd = ["rrq-executor", "--settings", "myapp.executor_config.python_executor_settings"]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3) Register Python handlers
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
# executor_config.py
|
|
116
|
+
import os
|
|
117
|
+
from pathlib import Path
|
|
118
|
+
|
|
119
|
+
from rrq.config import load_toml_settings
|
|
120
|
+
from rrq.executor_settings import PythonExecutorSettings
|
|
121
|
+
from rrq.registry import JobRegistry
|
|
122
|
+
|
|
123
|
+
from . import handlers
|
|
124
|
+
|
|
125
|
+
job_registry = JobRegistry()
|
|
126
|
+
job_registry.register("process_message", handlers.process_message)
|
|
127
|
+
|
|
128
|
+
config_path = Path(os.getenv("RRQ_EXECUTOR_CONFIG", "rrq.toml"))
|
|
129
|
+
rrq_settings = load_toml_settings(str(config_path))
|
|
130
|
+
|
|
131
|
+
python_executor_settings = PythonExecutorSettings(
|
|
132
|
+
rrq_settings=rrq_settings,
|
|
133
|
+
job_registry=job_registry,
|
|
134
|
+
)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 4) Run the Python executor
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
rrq-executor --settings myapp.executor_config.python_executor_settings
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 5) Run the Rust orchestrator
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
rrq worker run --config rrq.toml
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 6) Enqueue jobs (Python)
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
import asyncio
|
|
153
|
+
from rrq.client import RRQClient
|
|
154
|
+
from rrq.config import load_toml_settings
|
|
155
|
+
|
|
156
|
+
async def main():
|
|
157
|
+
settings = load_toml_settings("rrq.toml")
|
|
158
|
+
client = RRQClient(settings=settings)
|
|
159
|
+
await client.enqueue("process_message", "hello")
|
|
160
|
+
await client.close()
|
|
161
|
+
|
|
162
|
+
asyncio.run(main())
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
`rrq.toml` is the source of truth for the orchestrator and executors. Key areas:
|
|
168
|
+
|
|
169
|
+
- `[rrq]` basic settings (Redis, retries, timeouts, poll delay)
|
|
170
|
+
- `[rrq.executors.<name>]` stdio executor commands and pool sizes
|
|
171
|
+
- `[rrq.routing]` queue → executor mapping
|
|
172
|
+
- `[[rrq.cron_jobs]]` periodic scheduling
|
|
173
|
+
|
|
174
|
+
See `docs/CLI_REFERENCE.md` for CLI details and `docs/EXECUTOR_PROTOCOL.md` for
|
|
175
|
+
wire format.
|
|
176
|
+
|
|
177
|
+
## Cron Jobs (rrq.toml)
|
|
178
|
+
|
|
179
|
+
Use `[[rrq.cron_jobs]]` entries to enqueue periodic jobs while a worker is
|
|
180
|
+
running. Schedules are evaluated in UTC.
|
|
181
|
+
|
|
182
|
+
```toml
|
|
183
|
+
[[rrq.cron_jobs]]
|
|
184
|
+
function_name = "process_message"
|
|
185
|
+
schedule = "* * * * *"
|
|
186
|
+
args = ["cron payload"]
|
|
187
|
+
kwargs = { source = "cron" }
|
|
188
|
+
queue_name = "default"
|
|
189
|
+
unique = true
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Fields:
|
|
193
|
+
- `function_name` (required): Handler name to enqueue.
|
|
194
|
+
- `schedule` (required): Cron expression (standard 5-field format).
|
|
195
|
+
- `args` / `kwargs`: Optional arguments passed to the handler.
|
|
196
|
+
- `queue_name`: Optional override for the target queue.
|
|
197
|
+
- `unique`: Optional; uses a per-function unique lock to prevent duplicates.
|
|
198
|
+
|
|
199
|
+
## CLI Overview (Rust `rrq`)
|
|
200
|
+
|
|
201
|
+
- `rrq worker run`, `rrq worker watch`
|
|
202
|
+
- `rrq check`
|
|
203
|
+
- `rrq queue list|stats|inspect`
|
|
204
|
+
- `rrq job show|list|trace|replay|cancel`
|
|
205
|
+
- `rrq dlq list|stats|inspect|requeue`
|
|
206
|
+
- `rrq debug generate-jobs|generate-workers|submit|clear|stress-test`
|
|
207
|
+
|
|
208
|
+
## Worker Watch Mode
|
|
209
|
+
|
|
210
|
+
`rrq worker watch` runs a normal worker loop plus a filesystem watcher. It
|
|
211
|
+
watches a path recursively and normalizes change paths before matching include
|
|
212
|
+
globs (default `*.py`, `*.toml`) and ignore globs. A matching change triggers a
|
|
213
|
+
graceful worker shutdown, closes executors, and starts a fresh worker. Watch
|
|
214
|
+
mode is intended for local development; executor pool sizes are forced to 1 to
|
|
215
|
+
keep restarts lightweight.
|
|
216
|
+
|
|
217
|
+
## Testing
|
|
218
|
+
|
|
219
|
+
Runtime-only Python tests (producer + executor + store):
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
uv run pytest
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Rust conformance tests (parity vs golden snapshots):
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
cd reference/rust
|
|
229
|
+
cargo test -p rrq-orchestrator --test engine_conformance
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
End-to-end integration (Python-only, Rust-only, mixed):
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
uv run python -m examples.integration_test
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Legacy Python Orchestrator
|
|
239
|
+
|
|
240
|
+
The retired Python orchestrator and its tests/examples are preserved under
|
|
241
|
+
`legacy/` for reference.
|
|
242
|
+
|
|
243
|
+
## Reference Implementations
|
|
244
|
+
|
|
245
|
+
- Rust orchestrator: `reference/rust/rrq-orchestrator`
|
|
246
|
+
- Rust producer: `reference/rust/rrq-producer`
|
|
247
|
+
- Rust executor: `reference/rust/rrq-executor`
|
|
248
|
+
- Protocol types: `reference/rust/rrq-protocol`
|
|
249
|
+
- Python stdio executor example: `reference/python/stdio_executor.py`
|
|
250
|
+
|
|
251
|
+
## Telemetry
|
|
252
|
+
|
|
253
|
+
Optional tracing integrations are available for Python producers and the Python
|
|
254
|
+
executor runtime. See `rrq/integrations/`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
rrq/bin/README.md,sha256=bPXVrY_D4tK9aQfSfve8XwBCEPeQKoDGUVphHGLVR3o,197
|
|
2
|
+
rrq-0.8.1.dist-info/METADATA,sha256=XGMlJHHAv4fAnDpXqkCucSdu3tWliBMZsJrSvlBb8is,8135
|
|
3
|
+
rrq-0.8.1.dist-info/WHEEL,sha256=EypSW_OJMoGM3Ylk7WpR-GLwh3yetrjhtmWBPcFcui4,102
|
|
4
|
+
rrq-0.8.1.dist-info/entry_points.txt,sha256=9qAjFtzHRRzunffI-C8-1GYXzb0aB7KihLo7VV_YHyA,78
|
|
5
|
+
rrq-0.8.1.dist-info/licenses/LICENSE,sha256=XDvu5hKdS2-_ByiSj3tiu_3zSsrXXoJsgbILGoMpKCw,554
|
|
6
|
+
rrq-0.8.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2025 Mazdak Rezvani
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|