我有使用主管开始花的挑战.
我的开发环境中的以下命令适用于控制台
celery --app=celery_conf.celeryapp flower --conf=flowerconfig
但转向生产使用主管我遇到了各种各样的错误
/supervisor/conf.d/flower.conf
[program:flower] command=/opt/apps/venv/my_app/bin/celery flower --app=celery_conf.celeryapp --conf=flowerconfig directory=/opt/apps/my_app user=www-data autostart=true autorestart=false redirect_stderr=true stderr_logfile=/var/log/celery/flower.err.log stdout_logfile=/var/log/celery/flower.out.log
使用上面的配置,没有错误,但所有芹菜都给我一个像输出的帮助.它喜欢它不承认传递的变量.
Type 'celery--help' for help using a specific command. Usage: celery [options] Show help screen and exit. Options: -A APP, --app=APP app instance to use (e.g. module.attr_name) -b BROKER, --broker=BROKER url to broker. default is 'amqp://guest@localhost//' --loader=LOADER name of custom loader class to use. etc.. etc.. etc...
另一方面,主管抛出 INFO exited: flower (exit status 64; not expected)
我有其他主管启动的应用程序使用celery_beat
和使用github上的配置文件示例,它们与上面相同的目录路径运行良好
flowerconfig如下:
flowerconfig.py
# Broker settings BROKER_URL = 'amqp://guest:guest@localhost:5672//' # RabbitMQ management api broker_api = 'http://guest:guest@localhost:15672/api/' #Port port = 5555 # Enable debug logging logging = 'INFO'
解:
好吧,不是真正的解决方案所以我没有把它作为答案.原来我的虚拟环境出了问题.所以我删除了花并使用pip3.4再次安装,因为我在python3.4上
需要注意的是,对于花来使用你的flowerconfig
文件,你需要director=/path/to/your/celery_config/folder/
在主管的/etc/supervisor/conf.d/flower.conf
文件中添加一个条目,否则花将使用默认设置启动.
/etc/supervisor/conf.d/flower.conf
; ================================== ; Flower: For monitoring Celery ; ================================== [program:flower] command=/opt/apps/venv/my_app/bin/celery flower --app=celery_conf.celeryapp --conf=flowerconfig directory=/opt/apps/my_app/celery_conf #this is key as my configuration file was in the `celery_conf` folder user=www-data autostart=true autorestart=false redirect_stderr=true stderr_logfile=/var/log/celery/flower.err.log stdout_logfile=/var/log/celery/flower.out.log
谢谢.