For synchronous processing, we use supervisord with a beanstalkd queue. The application and worker code is all written in php (using SlmQueue). I notice that when we deploy new code, the new code isn't working for the worker processes. I am not quite sure what's the reason, but what I did found out:
service supervisor restart
does not restart the process (the PID keeps the same)supervisorctl reload
does reload all the processes, the new code is used for nowsupervisorctl
has no way (as I understand it) to reload only one program and keep the others still runningI am looking for a way to deploy new code (working via ansible and a git checkout) and no need to restart the complete supervisor process with all its children. We run Ubuntu 12.04 machines with PHP 5.5. I guess the opcode cache may play a role, but I am unsure how to trigger a flush for these specific files.
Is there any way to gracefully reload the processes and not completely reload all supervisord child processes? Or if the reason might be the opcode cache, is it possible to flush the cache with a certain trigger?
Start / Stop a Service To start a non-running service or stop a running one, use supervisorctl start my-daemon and supervisorctl stop my-daemon . To restart a service, you can also use supervisorctl restart my-daemon .
The supervisor service runs automatically after installation. You can check its status: sudo systemctl status supervisor.
Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database. Queues allow you to defer the processing of a time consuming task, such as sending an email, until a later time.
The supervisor is a process manager which Laravel suggests to use as a process monitor for queue workers. It will automatically start the queue worker in the background, even after the system has booted and will automatically restart the worker if the worker exits unexpectedly.
You can use supervisorctl to restart only one process.
supervisorctl -c /etc/supervisord/supervisord.conf
Once you are in the supervisor subshell you can use status
and restart
to reload your job.
Consider the following example where I reload flower
supervisor> status
beat_worker:beat_worker_00 RUNNING pid 32274, uptime 0:27:45
flower RUNNING pid 32275, uptime 0:27:45
workers:worker_wkrone_00 RUNNING pid 32278, uptime 0:27:45
workers:worker_wkrtwo_00 RUNNING pid 32276, uptime 0:27:45
workers:worker_wkrthree_00 RUNNING pid 32277, uptime 0:27:45
supervisor> restart flower
flower: stopped
flower: started
and now if you do a status again you will see that the pid of flower
has changed.
supervisor> status
beat_worker:beat_worker_00 RUNNING pid 32274, uptime 0:28:13
flower RUNNING pid 32713, uptime 0:00:08
workers:worker_wkrone_00 RUNNING pid 32278, uptime 0:28:13
workers:worker_wkrtwo_00 RUNNING pid 32276, uptime 0:28:13
workers:worker_wkrthree_00 RUNNING pid 32277, uptime 0:28:13
Then just do a ctrl -d
to exit the supervisord shell.
If you inspect the output of status you will see that the pid of the job changed and the uptime count restarted.
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