Skip to main content

Scheduling for rq.

Project description

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.1.1

Fixes for Python packaging.

0.1

Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hourglass-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file hourglass-0.1.1.tar.gz.

File metadata

  • Download URL: hourglass-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hourglass-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7ef2d911b34540cc17a35ff90d5de307378ac0e8653007f8b2a4e55371f1d60a
MD5 0ddbef2c7271c9c4b4abec975e34f45e
BLAKE2b-256 1cc5c428026ee9e126f0894a5732e95c7c8d12e6690affa7de2e9c0ac3f66d89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page