You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: implement Redis-backed result backend for task metadata storage
- Added RedisBackend struct to manage task metadata using Redis.
- Implemented methods to store, retrieve, and delete task metadata.
- Introduced configuration options for key prefix and result TTL.
- Added an in-memory backend for testing purposes.
- Included unit tests to verify functionality of the Redis backend.
* fix: remove unused dependencies and update logo in README
* docs: update CHANGELOG and README for Redis backend features and example enhancements
Copy file name to clipboardExpand all lines: README.md
+66-36Lines changed: 66 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,9 @@ We welcome contributions from everyone regardless of your experience level with
35
35
36
36
If you already know the basics of Rust but are new to Celery, check out the [Rusty Celery Book](https://rusty-celery.github.io/) or the original Python [Celery Project](http://www.celeryproject.org/).
37
37
38
-
## Quick start
38
+
## Getting Started
39
+
40
+
### Quick start
39
41
40
42
Define tasks by decorating functions with the [`task`](https://docs.rs/celery-rs/*/celery/attr.task.html) attribute.
41
43
@@ -73,13 +75,60 @@ And consume tasks as a worker from a queue with
73
75
my_app.consume().await?;
74
76
```
75
77
76
-
## Examples
78
+
### Capturing results
79
+
80
+
Configure a result backend to persist task state and fetch results from the client side:
[`AsyncResult`](https://docs.rs/celery-rs/latest/celery/task/struct.AsyncResult.html) now
114
+
exposes idiomatic helpers: `state()` for the latest `TaskState`, `ready()` to check completion,
115
+
and `get(timeout)` to await the final value (raising a `BackendError::Timeout` on expiration).
116
+
117
+
### Example catalog
77
118
78
119
The [`examples/`](https://github.com/GaiaNet-AI/celery-rs/tree/main/examples) directory contains:
79
120
80
121
- a simple Celery app implemented in Rust using an AMQP broker ([`examples/celery_app.rs`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/celery_app.rs)),
81
122
- the same Celery app implemented in Python ([`examples/celery_app.py`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/celery_app.py)),
82
-
- and a Beat app implemented in Rust ([`examples/beat_app.rs`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/beat_app.rs)).
123
+
- a Redis result-backend demo showing AsyncResult usage ([`examples/redis_results.rs`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/redis_results.rs)),
124
+
- a Beat app implemented in Rust ([`examples/beat_app.rs`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/beat_app.rs)),
125
+
- and a Redis-backed Beat scheduler with leader election ([`examples/redis_beat.rs`](https://github.com/GaiaNet-AI/celery-rs/blob/main/examples/redis_beat.rs)).
126
+
127
+
## Running the Examples
128
+
129
+
Explore the demos interactively (preview below):
130
+
131
+

83
132
84
133
### Prerequisites
85
134
@@ -93,11 +142,7 @@ Otherwise simply run the helper script:
93
142
94
143
This will download and run the official [RabbitMQ](https://www.rabbitmq.com/) image (RabbitMQ is a popular AMQP broker).
95
144
96
-
### Run the examples
97
-
98
-

99
-
100
-
#### Run Rust Celery app
145
+
### Run the Rust Celery app
101
146
102
147
You can consume tasks with:
103
148
@@ -113,7 +158,7 @@ cargo run --example celery_app produce [task_name]
113
158
114
159
Current supported tasks for this example are: `add`, `buggy_task`, `long_running_task` and `bound_task`
115
160
116
-
####Run Python Celery app
161
+
### Run the Python Celery app
117
162
118
163
Similarly, you can consume or produce tasks from Python by running
119
164
@@ -130,7 +175,7 @@ python examples/celery_app.py produce
130
175
131
176
You'll need to have Python 3 installed, along with the requirements listed in the `requirements.txt` file. You'll also have to provide a task name. This example implements 4 tasks: `add`, `buggy_task`, `long_running_task` and `bound_task`
132
177
133
-
####Run Rust Beat app
178
+
### Run the Rust Beat app
134
179
135
180
You can start the Rust beat with:
136
181
@@ -140,7 +185,7 @@ cargo run --example beat_app
140
185
141
186
And then you can consume tasks from Rust or Python as explained above.
142
187
143
-
####Redis-backed Beat
188
+
### Redis-backed Beat failover
144
189
145
190
A Redis-powered distributed scheduler backend is available through `RedisSchedulerBackend`.
146
191
To try it out locally (requires a Redis server running):
@@ -166,33 +211,18 @@ To test multi-instance failover:
166
211
⚠️ = Partially implemented and under active development.<br/>
167
212
🔴 = Not supported yet but on-deck to be implemented soon.
168
213
169
-
### Core
170
-
171
214
> **Note**: Issue tracking links below reference this repository.
0 commit comments