ask*_*sol 13
从Celery 3.0开始,crontab计划现在支持day_of_month
和month_of_year论证:http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules
Dhi*_*aTN 10
您可以使用Crontab 计划来执行此操作,并且可以定义它:
from 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.
},
}
Run Code Online (Sandbox Code Playgroud)
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.
},
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5081 次 |
| 最近记录: |