Forked from pratik-choudhari/schedule_with_rq_scheduler.py
Created
October 21, 2021 19:10
-
-
Save giridharmb/15d715f3c6c0e4c2db9b359de18467cc to your computer and use it in GitHub Desktop.
using rq scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rq_scheduler import Scheduler | |
| queue = Queue('circle', connection=Redis()) | |
| scheduler = Scheduler(queue=queue) | |
| scheduler.schedule( | |
| scheduled_time=datetime.utcnow(), # Time for first execution, in UTC timezone | |
| func=func, # Function to be queued | |
| args=[arg1, arg2], # Arguments passed into function when executed | |
| kwargs={'foo': 'bar'}, # Keyword arguments passed into function when executed | |
| interval=60, # Time before the function is called again, in seconds | |
| repeat=None, # Repeat this number of times (None means repeat forever) | |
| meta={'foo': 'bar'} # Arbitrary pickleable data on the job itself | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment