我有一个使用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