For a little bit of background. I am using Supervisor to monitor a django-celery process. I need to be able to set the virutalenv then start the celeryd process.
The way that I am currently doing it is by, in the supervisor.conf file I have
[program:celery]
command = /srv/worker.sh
stdout_logfile = /srv/supervisor.log
stderr_logfile = /srv/supervisor.log
Then in worker.sh I have
/bin/su - username -c "source /srv/virtualenvs/bin/activate; python /srv/manage.py celeryd
This works, sort of. The problem is that when I supervisorctl stop celery with supervisor it does not kill the workers. They still remain. I'm thinking if I am able to activate the virtualenv within supervisor, everything will work better than dropping into a shell script.
The TERM signal is getting sent to the shell script instead of celeryd. Either don't use it (because you can set the user from the supervisord conf) or use exec.
Anyway, best practice is (if you don't care about losing some tasks): short stopwaitsecs and killasgroup=true.
Eg:
[program:celery]
command=celeeryd blablabla
user=username
stopwaitsecs=10
killasgroup=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With