我正在使用具有指定间隔的作业Django-rq
的功能。Scheduling
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
- 现在我们有了每 60 秒执行一次并
JOB ID
为我们的调度程序返回的 JOB,我只想查看已执行的作业(次数/计数次数)。
example:
checking job `queue.fetch_job('5eedcd69-a318-4195-959f-eb6a404dec97').count` should return `5` times after 5 minutes
- 有没有办法通过Django或者RQ的方式来实现呢?