2016-05-14 8 views
3

Versuch, Supervisord (3.2.2) mit Sellerie multi zu laufen.Selleryd multi mit supervisord

Scheint so zu sein, dass supervisord nicht damit umgehen kann. Single Sellerie Arbeiter funktioniert gut.

Dies ist meine supervisord Konfiguration

celery multi v3.1.20 (Cipater) 
> Starting nodes... 
    > [email protected]: OK 
Stale pidfile exists. Removing it. 
    > [email protected]: 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)[email protected]%(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 

Im folgenden supervisord Variablen mit der Art, wie ich Sellerie beginnen zu emulieren:

  • % (program_name) s
  • % (Prozessnummer) d
  • @
  • % (host_node_name) s

Supervisorctl

supervisorctl 
celery:[email protected] FATAL  Exited too quickly (process log may have details) 
celery:[email protected] FATAL  Exited too quickly (process log may have details) 

Ich habe versucht, diesen Wert in/usr/local/lib/python2.7/dist-packages/supervisor/options.py from 0 to 1:

Ändern
numprocs_start = integer(get(section, 'numprocs_start', 1)) 

ich noch bekommen:

celery:[email protected] FATAL  Exited too quickly (process log may have details) 
celery:[email protected] EXITED May 14 12:47 AM 

Sellerie fängt an, aber Supervisord merkt es nicht.

root @ parzee-dev-app-SFO1:/etc/Supervisor #

ps -ef | grep celery 
root  2728  1 1 00:46 ?  00:00:02 [celeryd: [email protected]:MainProcess] -active- (worker -c 16 -n [email protected] --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: [email protected]:MainProcess] -active- (worker -c 16 -n [email protected] --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 [email protected]{HOSTNAME} -f $CELERY_LOGFILE $CELERYD_OPTS 

Ähnliche: Running celeryd_multi with supervisor How to use Supervisor + Django + Celery with multiple Queues and Workers?

Antwort

8

Seit Supervisor überwacht (start/stop/restart), sollte der Prozess im Vordergrund ausgeführt werden (sollte kein Daemon sein) ie).

Sellerie multi dämmt sich selbst, so dass es nicht mit Supervisor ausgeführt werden kann.

Sie können einen separaten Prozess für jeden Worker erstellen und ihn in einen gruppieren.

[program:worker1] 
command=celery worker -l info -n worker1 

[program:worker2] 
command=celery worker -l info -n worker2 

[group:workers] 
programs=worker1,worker2 

können Sie auch ein Shell-Skript, die makes daemon process run in foreground so schreiben.

#! /usr/bin/env bash 
set -eu 

pidfile="/var/run/your-daemon.pid" 
command=/usr/sbin/your-daemon 

# Proxy signals 
function kill_app(){ 
    kill $(cat $pidfile) 
    exit 0 # exit okay 
} 
trap "kill_app" SIGINT SIGTERM 

# Launch daemon 
$ celery multi start 2 -l INFO 

sleep 2 

# Loop while the pidfile and the process exist 
while [ -f $pidfile ] && kill -0 $(cat $pidfile) ; do 
    sleep 0.5 
done 
exit 1000 # exit unexpected 
+0

Dank Ich endete meine Multi-Konfiguration in einzelne Arbeiter aufgeteilt – spicyramen

Verwandte Themen