如何使用生产中提供的celeryd.conf文件

时间:2012-10-11 05:35:09

标签: python django celery django-celery

这是https://github.com/ask/django-celery/blob/master/contrib/supervisord/celeryd.conf提供的文件。我该如何运行这个conf文件?

我使用gunicorn运行我的django应用程序

; =======================================
;  celeryd supervisor example for Django
; =======================================

[program:celery]
command=/path/to/project/manage.py celeryd --loglevel=INFO
directory=/path/to/project
user=nobody
numprocs=1
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=10

; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600

; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998

由于

1 个答案:

答案 0 :(得分:0)

该配置文件无法自行运行;它适用于supervisord

您需要使用pip install supervisor安装supervisord(如果您有pip,使用sudo echo_supervisord_conf > /etc/supervisord.conf),create a configuration file for it,然后将上述文件的内容复制粘贴到您的supervisord配置文件中,如上所述在Adding a program下的supervisord文档中。

所以基本上在你的shell上运行以下命令:

pip install supervisor
sudo echo_supervisord_conf > /etc/supervisord.conf
sudo wget -O - -o /dev/null https://raw.github.com/ask/django-celery/master/contrib/supervisord/celeryd.conf >> /etc/supervisor.conf
sudo $EDITOR /etc/supervisor.conf

并根据您的内容编辑配置文件。