rq-schedulerProvides job scheduling capabilities to RQ (Redis Queue) | |
Download |
rq-scheduler Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Selwin Ong
- Publisher web site:
- https://github.com/ui/
rq-scheduler Tags
rq-scheduler Description
rq-scheduler is a small package that adds job scheduling capabilities to RQ, a Redis based Python queuing library.InstallationYou can install RQ Scheduler via pip:pip install rq-schedulerUsageSchedule a job involves doing two different things: 1. Putting a job in the scheduler 2. Running a scheduler that will move scheduled jobs into queues when the time comesScheduling a JobHere's how to put a job in the scheduler:from redis import Redisfrom rq_scheduler import Schedulerfrom datetime import datetime# Instantiates a scheduler for the "default" queuescheduler = Scheduler('default', connection=Redis())# Puts a job into the scheduler. The API is similar# to rq except that it takes a datetime object as first argumentscheduler.enqueue(datetime(2020, 01, 01, 1, 1), func)scheduler.enqueue(datetime(2025, 10, 10, 3, 4), func, foo, bar=baz)Running the schedulerRQ Scheduler comes with a script rqscheduler that runs a scheduler process that polls Redis once every minute and move scheduled jobs to the relevant queues when they need to be executed:rqscheduler --host localhost --port 6379 --db 0The script accepts these arguments:- -H or --host: Redis server to connect to- -p or --port: port to connect to- -d or --db: Redis db to use- -P or --password: password to connect to RedisProduct's homepage
rq-scheduler Related Software