作为Ubuntu服务的Celery守护进程在从terminal运行时不消耗任务

在Ubuntu 11.10上,

我必须使用芹菜从django发出python任务。

我目前正在同一台机器上testing,但最终芹菜工人应该在远程机器上运行。

Django使用以下设置:

BROKER_HOST = "127.0.0.1" BROKER_PORT = 5672 BROKER_VHOST = "/my_vhost" BROKER_USER = "celery" BROKER_PASSWORD = "celery" 

我也可以看到我的任务在http:// localhost:55672 /#/队列中排队

celery守护进程使用以下configuration(celeryconfig.py):

 BROKER_HOST = "127.0.0.1" BROKER_PORT = 5672 BROKER_USER = "celery" BROKER_PASSWORD = "celery" BROKER_VHOST = "/my_vhost" CELERY_RESULT_BACKEND = "amqp" import os import sys sys.path.append(os.getcwd()) CELERY_IMPORTS = ("tasks", ) 

赛跑

 celeryd -l info 

运作良好,现在我想运行它作为一项服务。

我遵循http://ask.github.com/celery/cookbook/daemonizing.html中的说明

现在我试图运行它使用:

 sudo /etc/init.d/celeryd start 

但消息没有被消耗,芹菜日志也没有错误。

在/ etc /默认/ celeryd

 CELERYD_NODES="w1" CELERYD_CHDIR="/path/to/django/project" CELERYD_OPTS="--time-limit=300 --concurrency=1" CELERY_CONFIG_MODULE="celeryconfig" # %n will be replaced with the nodename. CELERYD_LOG_FILE="/var/log/celery/%n.log" CELERYD_PID_FILE="/var/run/celery/%n.pid" # Workers should run as an unprivileged user. CELERYD_USER="celery" CELERYD_GROUP="celery" 

我也在Ubuntu中创build用户芹菜不知道是否有必要。

任何帮助将不胜感激,谢谢,盖伊

更改celeryconfig.py权限(所有者):

 sudo chown root:staff celeryconfig.py 

它的作品…很容易跟踪后,我意识到:

 sudo /etc/init.d/celeryd status 

给出了一个信息错误的解释。

家伙

我们使用supervisor在Ubuntu上运行Celery,它运行得非常好,包括定期状态检查和重新启动死进程。