尝试使用celery multi运行supervisord(3.2.2)。
看起来supervisord处理不了。单个celery worker可以正常工作。
这是我的supervisord配置:
celery multi v3.1.20 (Cipater)
> Starting nodes...
> celery1@parzee-dev-app-sfo1: OK
Stale pidfile exists. Removing it.
> celery2@parzee-dev-app-sfo1: OK
Stale pidfile exists. Removing it.
celeryd.conf
; ==================================
; celery worker supervisor example
; ==================================
[program:celery]
; Set full path to celery program if using virtualenv
command=/usr/local/src/imbue/application/imbue/supervisorctl/celeryd/celeryd.sh
process_name = %(program_name)s%(process_num)d@%(host_node_name)s
directory=/usr/local/src/imbue/application/imbue/conf/
numprocs=2
stderr_logfile=/usr/local/src/imbue/application/imbue/log/celeryd.err
logfile=/usr/local/src/imbue/application/imbue/log/celeryd.log
stdout_logfile_backups = 10
stderr_logfile_backups = 10
stdout_logfile_maxbytes = 50MB
stderr_logfile_maxbytes = 50MB
autostart=true
autorestart=false
startsecs=10
我正在使用以下supervisord变量来模拟启动celery的方式:
- %(program_name)s
- %(process_num)d
- @
- %(host_node_name)s
Supervisorctl
supervisorctl
celery:celery1@parzee-dev-app-sfo1 FATAL Exited too quickly (process log may have details)
celery:celery2@parzee-dev-app-sfo1 FATAL Exited too quickly (process log may have details)
我尝试将 /usr/local/lib/python2.7/dist-packages/supervisor/options.py
中的这个值从 0 改为了 1:
numprocs_start = integer(get(section, 'numprocs_start', 1))
我仍然会得到以下内容:
celery:celery1@parzee-dev-app-sfo1 FATAL Exited too quickly (process log may have details)
celery:celery2@parzee-dev-app-sfo1 EXITED May 14 12:47 AM
Celery已经开始运行,但是supervisord没有跟踪它。
root@parzee-dev-app-sfo1:/etc/supervisor#
ps -ef | grep celery
root 2728 1 1 00:46 ? 00:00:02 [celeryd: celery1@parzee-dev-app-sfo1:MainProcess] -active- (worker -c 16 -n celery1@parzee-dev-app-sfo1 --loglevel=DEBUG -P processes --logfile=/usr/local/src/imbue/application/imbue/log/celeryd.log --pidfile=/usr/local/src/imbue/application/imbue/log/1.pid)
root 2973 1 1 00:46 ? 00:00:02 [celeryd: celery2@parzee-dev-app-sfo1:MainProcess] -active- (worker -c 16 -n celery2@parzee-dev-app-sfo1 --loglevel=DEBUG -P processes --logfile=/usr/local/src/imbue/application/imbue/log/celeryd.log --pidfile=/usr/local/src/imbue/application/imbue/log/2.pid)
celery.sh
source ~/.profile
CELERY_LOGFILE=/usr/local/src/imbue/application/imbue/log/celeryd.log
CELERYD_OPTS=" --loglevel=DEBUG"
CELERY_WORKERS=2
CELERY_PROCESSES=16
cd /usr/local/src/imbue/application/imbue/conf
exec celery multi start $CELERY_WORKERS -P processes -c $CELERY_PROCESSES -n celeryd@{HOSTNAME} -f $CELERY_LOGFILE $CELERYD_OPTS
类似的问题: 如何使用supervisor运行celeryd_multi 如何在Supervisor + Django + Celery中使用多个队列和工作进程?