I'm using Django-rq
which has the functionality of Scheduling
the jobs with specified interval.
https://github.com/rq/django-rq#support-for-rq-scheduler
task = 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
)
print(task.id) ### JOB ID
5eedcd69-a318-4195-959f-eb6a404dec97
- Now we have the JOB which executes for every 60 seconds and returns
JOB ID
for our scheduler, All I wanted to see the (number of times/count the number of times) the job has been executed.
example:
checking job `queue.fetch_job('5eedcd69-a318-4195-959f-eb6a404dec97').count` should return `5` times after 5 minutes
- Is there any way to achieve it through the Django or RQ way?