On Tue, Sep 23, 2014 at 08:30:15AM +0200, Roberto De Ioris wrote: > > > Ciao a tutti, > > > > > > sto cercando la configrazione ottimale per fare partire celery con > > django in produzione. > > > > Uso nginx + uwsgi per l'applicazione principale e credevo leggendo [1] > > [2] che smart-attach-daemon avrebbe potuo risolvere il problema di > > garantirmi che un reload di uwsgi (uwsgi --reload) inviasse un segnale > > al processo di celery. > > > > Forse ho compreso male la documentazione che in effetti non dice > > esplicitamente cosa dovrebbe succedere ma solo :: > > > > > > Pidfile governed processes can survive death or reload of the master > > so long as their pidfiles are available and the pid contained > > therein matches a running pid. This is the best choice for processes > > requiring longer persistence, and for which a brutal kill could mean > > loss of data such as a database. > > > > smart-attach-daemon serve proprio ad evitare che un demone venga ucciso > durante un riavvio. Effettivamente celery (almeno nella mia mente) e' uno > di quei servizi che dovrebbe andare per fatti suoi, e quindi > smart-attach-daemon e' l'approggio giusto. > > Mi pare di capire pero' che tu invece vuoi che a ogni reload corrisponda > anche un restart di celery, in questo caso attach-daemon e' quello che ti > serve. > > Eventualmente con attach-daemon2 hai un controllo maggiore sul comportamento: > > https://github.com/unbit/uwsgi-docs/blob/master/AttachingDaemons.rst#--attach-daemon2
Sarebbe esattamente quello che cerco, ma non riesco assolutamente a vedere alcun segnale. La mia conf è: celery_pid = /var/run/uwsgi/cogema-celery.pid attach-daemon2 = cmd=/usr/local/sbin/test-signals.py %(celery_pid),pidfile=%(celery_pid),stopsignal=3,reloadsignal=15 La script test-signals.py è riportata in fondo. Quando io faccio partire uwsgi nei log leggo: [uwsgi-daemons] found valid/active pidfile for "/usr/local/sbin/test-signals.py /var/run/uwsgi/cogema-celery.pid" (pid: 31952) Ma poi nessun segnale arriva al processo test-signals.py. Se da console per prova eseguo kill -3 31952, vedo subito il log del segnale arrivato. lumi? grazie sandro =============================================== #!/usr/bin/python import os import sys import time import signal def show(sig, frame): f = open('/tmp/sig.log', 'a') f.write("%s \n" % sig) def sig_start(): sigs = range(2,16) sigs.remove(9) for sig in sigs: signal.signal(sig, show) ## log the pid #f = open('/var/run/uwsgi/cogema-celery.pid', 'w') f = open(sys.argv[1], 'w') f.write("%s\n" % os.getpid()) f.close() sig_start() while 1: time.sleep(5) _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python