Reputation: 10642
Try as I might I cannot kill these celery workers.
I run:
celery --app=my_app._celery:app status
I see I have 3 (I don't understand why 3 workers = 2 nodes, please explain if you know)
celery@ip-x-x-x-x: OK
celery@ip-x-x-x-x: OK
celery@named-worker.%ip-x-x-x-x: OK2 nodes online.
I run (as root):
ps auxww | grep 'celery@ip-x-x-x-x' | awk '{print $2}' | xargs kill -9
The workers just keep reappearing with a new PID.
Please help me kill them.
Upvotes: 2
Views: 5217
Reputation: 523
ps -aux | grep celery
I get :
simon 24615 3.8 0.6 344276 219604 pts/3 S+ 22:53 0:56 /usr/bin/python3 /home/simon/.local/bin/celery -A worker_us_task worker -l info -Q us_queue --concurrency=30 -n us_worker@%h
pkill -9 -f 'worker_us_task worker'
Upvotes: 2
Reputation: 29554
A process whose pid keeps changing is called comet
. Even though pid of this process keeps on changing, its process group ID remains constant. So you can kill by sending a signal.
ps axjf | grep '[c]elery' | awk '{print $3}' | xargs kill -9
Alternatively, you can also kill with pkill
pkill -f celery
This kills all processes with fullname celery
.
Upvotes: 10
Reputation: 22403
I always use:
ps auxww | grep 'celery' | awk '{print $2}' | xargs kill -9
If you're using supervisord
to run celery, you need to kill supervisord
process also.
Upvotes: 0
Reputation: 603
pkill -f celery
Run from the command line, this will kill at processes related to celery.
Upvotes: 3