どのようにしてタスクをスケジュールするのですか? セロリ 毎月1日に実行されますか?
回答:
回答№1の11Celery 3.0以降、crontabのスケジュールがサポートされています day_of_month
そして month_of_year
引数: http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules
回答№2の場合は1
あなたはこれを使うことができます Crontabのスケジュール あなたはこれを次のように定義します:
- あなたのdjangoで settings.py:
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.
},
}
- に celery.py config:
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.
},
}