{"id":6229,"library":"rq-scheduler","title":"RQ Scheduler","description":"RQ Scheduler provides a job scheduling layer for RQ (Redis Queue), allowing users to schedule jobs to run at specific times or on recurring cron-like schedules. It is an active project, currently at version 0.14.0, with releases coinciding with major RQ updates and feature additions.","status":"active","version":"0.14.0","language":"en","source_language":"en","source_url":"https://github.com/rq/rq-scheduler","tags":["queue","scheduler","redis","task-queue","background-jobs"],"install":[{"cmd":"pip install rq-scheduler","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for task queuing; version compatibility is critical.","package":"rq","optional":false},{"reason":"Required for connecting to the Redis server where jobs and queue data are stored.","package":"redis","optional":false},{"reason":"Used for parsing cron strings; replaced 'croniter' in v0.13.0.","package":"crontab","optional":false}],"imports":[{"symbol":"Scheduler","correct":"from rq_scheduler import Scheduler"}],"quickstart":{"code":"import os\nfrom redis import Redis\nfrom rq_scheduler import Scheduler\nfrom datetime import datetime, timedelta\n\ndef my_job(arg1, arg2):\n    print(f'Running job with args: {arg1}, {arg2}')\n    return arg1 + arg2\n\n# Ensure a Redis connection is available. Use a default if REDIS_URL not set.\nredis_url = os.environ.get('REDIS_URL', 'redis://localhost:6379')\nredis_conn = Redis.from_url(redis_url)\n\n# Instantiate the scheduler with the Redis connection\nscheduler = Scheduler(connection=redis_conn)\n\n# Example 1: Schedule a job to run once at a specific time\njob_at_time = datetime.utcnow() + timedelta(seconds=10)\nscheduler.enqueue_at(\n    job_at_time,              # Time to run the job\n    my_job,                   # Function to be called\n    'hello', 'world'          # Arguments for the function\n)\nprint(f\"Scheduled 'my_job' to run at {job_at_time} UTC\")\n\n# Example 2: Schedule a recurring job using cron syntax (every minute)\n# Note: This will repeatedly add the job to the queue based on the cron string.\n# Ensure 'rq-scheduler' process is running for this to work.\nscheduler.cron(\n    '*/1 * * * *',            # Cron string (every minute)\n    func=my_job,              # Function to be called\n    args=('cron_arg1', 'cron_arg2'), # Arguments for the function\n    repeat=None,              # Run indefinitely\n    queue_name='default'      # Queue to add the job to\n)\nprint(\"Scheduled 'my_job' to run every minute via cron\")\n\n# To run the scheduler, you would execute `rq-scheduler` in your terminal.\n# To process jobs, you would execute `rq worker` in your terminal.\n","lang":"python","description":"This quickstart demonstrates how to instantiate `rq_scheduler.Scheduler` and schedule a job to run at a specific future time using `enqueue_at` and a recurring job using `cron`. Ensure your Redis server is running and that both `rq-scheduler` and `rq worker` processes are started separately for the scheduled jobs to be processed."},"warnings":[{"fix":"Ensure your `rq-scheduler` and `rq` package versions are compatible. For `rq-scheduler==0.14.0`, use `rq>=2.0.0`. Check `rq-scheduler` release notes for specific `rq` version requirements.","message":"RQ Scheduler v0.14.0 and later support RQ 2.0+. Using older versions of `rq-scheduler` with RQ 2.0+ or newer `rq-scheduler` with older RQ versions can lead to compatibility issues or errors.","severity":"breaking","affected_versions":"<0.14.0 with RQ 2.0+, >=0.14.0 with RQ <2.0"},{"fix":"Upgrade your Python environment to 3.6 or newer. If you must use an older Python, stick to `rq-scheduler<0.13.0`.","message":"Starting with v0.13.0, `rq-scheduler` requires Python 3.6 or newer. Older Python versions are no longer supported.","severity":"breaking","affected_versions":"<0.13.0 (for Python 3.5 or earlier)"},{"fix":"Start both `rq-scheduler` and `rq worker` processes concurrently. E.g., in separate terminal tabs or managed by a process supervisor (like Supervisord or systemd).","message":"The `rq-scheduler` process is separate from `rq` worker processes. You must run `rq-scheduler` via its command-line tool (`rq-scheduler`) and `rq` workers via `rq worker` for scheduled jobs to be added to the queue and then processed.","severity":"gotcha","affected_versions":"All"},{"fix":"Pass the same `redis.Redis` connection object or connection parameters (e.g., `REDIS_URL`) to both your `Scheduler` instance and your `rq` workers.","message":"The `rq-scheduler` instance must connect to the same Redis database as your `rq` workers and application. Using different Redis connections will result in jobs not being scheduled or processed correctly.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}