hourglass is a minimalist scheduler for rq.
hourglass provides a date-sorted queue class, Schedule, that stores jobs that are to be run at some point in the future, and a daemon script, hourglass, that delegates those jobs to the regular queues processed by rqworker processes.
Usage
Run the hourglass daemon script included with the package. Example usage:
import times
from datetime import timedelta
from rq import use_connection
from hourglass import Schedule
def test_job(n):
return n
use_connection()
s = Schedule()
# schedule a job to be run 3 minutes from now
eta = times.now() + timedelta(0, 180)
job = s.enqueue(eta, test_job, 5)
hourglass managed jobs include an additional property, eta, which is the time passed as the first argument to Schedule.enqueue and Schedule.enqueue_job. They also include another property, queue for specifying which queue to dispatch the job to when eta has elapsed.
The Schedule queue and hourglass daemon use UTC times under the hood, so eta’s passed to the scheduler should be in UTC as well.
Changelog
0.2
Compatibility updates for rq-0.3.0
0.1.2
Made Schedule.enqueue_job and Schedule.compact atomic.
0.1.1
Fixes for Python packaging.
0.1
Initial release.
Release files for hourglass 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hourglass-0.2.tar.gz | 6.7 kB | Details |
Release files / hourglass-0.2.tar.gz
| Download URL | hourglass-0.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07b3180a958e642fb4639258a42fb15506c48393d93a00d2f54381fbc9b73547
|
|
BLAKE2b-256 checksum How to use checksums |
920feed6013088753f930bf87424750610b8f60527498492237806e77e5593e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |