Skip to content

Commit 216a42e

Browse files
committed
Bump version to 2.4.0
1 parent 49a669d commit 216a42e

File tree

5 files changed

+47
-4
lines changed

5 files changed

+47
-4
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### RQ 2.4.0 (2025-06-14)
2+
* Added `rq cron` CLI command. Thanks @selwin!
3+
* Various tests, typing improvements and cleanups. Thanks @SpecLad!
4+
* When a job is canceled, you can now optionally clean it from dependencies using `job.cancel(remove_from_dependencies=True)`. Thanks @Marishka17!
5+
* RQ now requires Python >= 3.9. Thanks @Jankovn and @selwin!
6+
17
### RQ 2.3.3 (2025-05-10)
28
* `WorkerPool` now accepts `queue_class` argument. Thanks @amonsh1!
39
* Disallow `redis-py=6.0.0`. Thanks @selwin and @terencehonles!

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ to have a low barrier to entry while scaling incredibly well for large applicati
44
It can be integrated into your web stack easily, making it suitable for projects
55
of any size—from simple applications to high-volume enterprise systems.
66

7-
RQ requires Redis >= 4 or Valkey >= 7.2.
7+
RQ requires Redis >= 5 or Valkey >= 7.2.
88

99
[![Build status](https://github.com/rq/rq/workflows/Test/badge.svg)](https://github.com/rq/rq/actions?query=workflow%3A%22Test%22)
1010
[![PyPI](https://img.shields.io/pypi/pyversions/rq.svg)](https://pypi.python.org/pypi/rq)
@@ -98,6 +98,40 @@ queue.enqueue(say_hello, retry=Retry(max=3, interval=[10, 30, 60]))
9898

9999
For a more complete example, refer to the [docs][d]. But this is the essence.
100100

101+
## Cron Style Job Scheduling
102+
103+
To schedule jobs to be enqueued at specific intervals, RQ >= 2.4 now provides a cron-like feature (support for cron syntax coming soon).
104+
105+
First, create a configuration file (e.g., `cron_config.py`) that defines the jobs you want to run periodically.
106+
107+
```python
108+
from rq import cron
109+
from myapp import cleanup_database, send_daily_report
110+
111+
# Run database cleanup every 5 minutes
112+
cron.register(
113+
cleanup_database,
114+
queue_name='default',
115+
interval=300 # 5 minutes in seconds
116+
)
117+
118+
# Send daily reports every 24 hours
119+
cron.register(
120+
send_daily_report,
121+
queue_name='repeating_tasks',
122+
args=('daily',),
123+
kwargs={'format': 'pdf'},
124+
interval=86400 # 24 hours in seconds
125+
)
126+
```
127+
128+
And then start the `rq cron` command to enqueue these jobs at specified intervals:
129+
130+
```sh
131+
$ rq cron cron_config.py
132+
```
133+
134+
More details on functionality can be found in the [docs](https://python-rq.org/docs/cron/).
101135

102136
### The Worker
103137

@@ -115,7 +149,7 @@ Job result = 818
115149
To run multiple workers in production, use process managers like `systemd`. RQ also ships with a beta version of `worker-pool` that lets you run multiple worker processes with a single command.
116150

117151
```console
118-
rq worker-pool -n 4
152+
$ rq worker-pool -n 4
119153
```
120154

121155
More options are documented on [python-rq.org](https://python-rq.org/docs/workers/).

docs/_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ navigation:
2020
url: /docs/exceptions/
2121
- text: Scheduling & Repeating Jobs
2222
url: /docs/scheduling/
23+
- text: Cron Style Scheduling
24+
url: /docs/cron/
2325
- text: Job Registries
2426
url: /docs/job_registries/
2527
- text: Monitoring

rq/scheduler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ def acquire_locks(self, auto_start=False):
9797
"""Returns names of queue it successfully acquires lock on"""
9898
successful_locks = set()
9999
pid = os.getpid()
100-
self.log.debug('Trying to acquire locks for %s', ', '.join(self._queue_names))
100+
self.log.debug('Acquiring scheduler lock for %s', ', '.join(self._queue_names))
101101
for name in self._queue_names:
102102
if self.connection.set(self.get_locking_key(name), pid, nx=True, ex=self.interval + 60):
103+
self.log.debug('Acquired scheduler lock for %s', name)
103104
successful_locks.add(name)
104105

105106
# Always reset _scheduled_job_registries when acquiring locks

rq/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.3.3'
1+
VERSION = '2.4.0'

0 commit comments

Comments
 (0)