我正在使用Fabric来部署Celery代理(运行RabbitMQ)以及通过celeryd
进行supervisor
守护的多个Celery工作者。我不能为我的生活弄清楚如何重新加载tasks.py
模块而不是重启服务器。
/etc/supervisor/conf.d/celeryd.conf
[program:celeryd]
directory=/fab-mrv/celeryd
environment=[RABBITMQ crendentials here]
command=xvfb-run celeryd --loglevel=INFO --autoreload
autostart=true
autorestart=true
celeryconfig.py
import os
## Broker settings
BROKER_URL = "amqp://%s:%s@hostname" % (os.environ["RMQU"], os.environ["RMQP"])
# List of modules to import when celery starts.
CELERY_IMPORTS = ("tasks", )
## Using the database to store task state and results.
CELERY_RESULT_BACKEND = "amqp"
CELERYD_POOL_RESTARTS = True
其他信息
celery --version
3.0.19(Chiastic Slide)python --version
2.7.3 lsb_release -a
Ubuntu 12.04.2 LTS rabbitmqctl status
...... 2.7.1 ...... 以下是我尝试过的一些事情:
celeryd --autoreload
标志sudo supervisorctl restart celeryd
celery.control.broadcast('pool_restart', arguments={'reload': True})
ps auxww | grep celeryd | grep -v grep | awk '{print $2}' | xargs kill -HUP
不幸的是,没有任何东西导致工作人员重新加载tasks.py模块(例如在运行git pull
以更新文件之后)。 相关工厂功能的要点是here。
经纪人/工人在重启后运行正常。
答案 0 :(得分:2)
只是在黑暗中拍摄,使用celeryd --autoreload
选项确定您拥有file system notification backends之一吗?它建议使用PyNotify for linux,所以我首先要确保你安装了它。