10
如何安排每月1日運行的celery任務?如何安排每月一日運行的芹菜任務?
如何安排每月1日運行的celery任務?如何安排每月一日運行的芹菜任務?
由於芹菜3.0 crontab的時間表現在支持day_of_month
和month_of_year
參數:http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules
爲此,您可以使用Crontab schedules,要麼你CAND定義是:在
你的Django settings.pyfrom celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
'my_periodic_task': {
'task': 'my_app.tasks.my_periodic_task',
'schedule': crontab(0, 0, day_of_month='1'), # Execute on the first day of every month.
},
}
from celery import Celery
from celery.schedules import crontab
app = Celery('app_name')
app.conf.beat_schedule = {
'my_periodic_task': {
'task': 'my_app.tasks.my_periodic_task',
'schedule': crontab(0, 0, day_of_month='1'), # Execute on the first day of every month.
},
}
你讀過http://celeryq.org/docs/reference/celery.schedules.html? – 2010-12-09 11:11:32