我有一個使用celeryd和celerybeat的django應用程序。兩者都設置爲以守護進程運行。 celerybeat任務不會執行,因爲celerybeat無法正確啓動。根據日誌它會立即關閉:Celerybeat在啓動後立即關閉
[2012-05-04 13:02:49,055: WARNING/MainProcess] celerybeat v2.5.1 is starting.
[2012-05-04 13:02:49,122: INFO/MainProcess] process shutting down
[2012-05-04 13:02:49,122: DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0
[2012-05-04 13:02:49,134: DEBUG/MainProcess] running the remaining "atexit" finalizers
我與它開始啓動/etc/int.d/celerybeat
這是在/ etc /默認/ celerybeat配置:
# Where the Django project is.
CELERYBEAT_CHDIR="/var/www/path_to_app/cms/"
# Python interpreter from environment.
ENV_PYTHON="$CELERYBEAT_CHDIR/bin/python"
# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="cms.settings"
# Path to celerybeat
CELERYBEAT="$ENV_PYTHON $CELERYBEAT_CHDIR/cms/manage.py celerybeat"
# Extra arguments to celerybeat
CELERYBEAT_LOG_LEVEL="DEBUG"
CELERYBEAT_USER="www-data"
CELERYBEAT_GROUP="www-data"
任務時間表設在settings.py:
CELERYBEAT_SCHEDULE = {
# Executes every morning at 7:00 A.M
"every-morning": {
"task": "cms.tasks.get_recent_posts_for_all_pages",
"schedule": crontab(hour=7, minute=00)
},
}
當我從./manage shell中運行celerybeat .py celerybeat它似乎運行良好。
celeryd配置中還有一個celerybeat部分,但我認爲其中一個被忽略。
問候 西蒙
經紀人你有沒有弄明白不見了? – Eli