[英]python-rq scheduler count the number of times job executed
我正在使用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
JOB ID
的JOB ID
,我只想看到該作業已執行的(次數/計數次數)。example:
checking job `queue.fetch_job('5eedcd69-a318-4195-959f-eb6a404dec97').count` should return `5` times after 5 minutes
不完全是。 Rq-scheduler 檢查當前作業的執行日期並計算下一個作業將在運行時執行的時間。 它不存儲過去和未來的工作(只存儲下一個)。
也許與此行為最接近的是“result_ttl”參數,您可以為其設置時間並定義作業在完成后將保留多長時間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.