2013-06-04 15 views
14

Sto utilizzando Fabric per distribuire un broker Celery (con RabbitMQ) e più worker Celery con celeryd daemonized tramite supervisor. Non posso per la vita di me capire come ricaricare il modulo tasks.py a corto di riavviare i server.Come posso ricaricare automaticamente i moduli delle attività con il daemon Celery?


/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:%[email protected]" % (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 

Ulteriori informazioni

  • 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 ...

Qui ar via e alcune cose che ho provato:

  • La bandiera 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

E, purtroppo, nulla fa sì che i lavoratori di ricaricare il modulo tasks.py (per esempio dopo aver eseguito git pull per aggiornare il file). L'essenza delle funzioni fab rilevanti è disponibile here.

Gli agenti/broker corrono bene dopo un riavvio.

+2

'supervisorctl restart' di solito fa il trucco per me. –

+0

Ahimè, non per me. Ho aggiunto un elenco per il mio 'fabfile.py' con le relative funzioni favolose estratte. – pztrick

+0

vasta ipotesi qui, ma hai provato a eliminare '* .pyc' prima di ricaricare? –

risposta

2

Solo uno scatto al buio, con l'opzione celeryd --autoreload ti sei assicurato di avere uno degli file system notification backends? Raccomanda PyNotify per Linux, quindi inizierei assicurandoti di averlo installato.

+1

Nessun dado. :('Requisiti già soddisfatti (utilizzare - upgrade per l'aggiornamento): pyinotify in/usr/local/lib/python2.7/dist-packages' ** (versione 0.9.4) ** – pztrick

Problemi correlati