我有一个使用celeryd和celerybeat的django应用程序。两者都设置为以守护进程身份运行。 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 start
开始的这是/ etc / default / celerybeat config:
# 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.py celerybeat从shell中运行celerybeat时,似乎运行正常。
celeryd配置中还有一个celerybeat部分,但我假设一个被忽略。
此致 西蒙
答案 0 :(得分:0)
也许你错过了使用像rabbitmq这样的经纪人 http://celery.readthedocs.org/en/latest/getting-started/brokers/rabbitmq.html