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.3lsb_release -a
Ubuntu 12.04.2 LTSrabbitmqctl 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.
'supervisorctl restart' di solito fa il trucco per me. –
Ahimè, non per me. Ho aggiunto un elenco per il mio 'fabfile.py' con le relative funzioni favolose estratte. – pztrick
vasta ipotesi qui, ma hai provato a eliminare '* .pyc' prima di ricaricare? –