Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't kill celery workers

Tags:

celery

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: OK

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

like image 965
rix Avatar asked Sep 12 '26 13:09

rix


2 Answers

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.

Reference: killing a process

like image 101
Pandikunta Anand Reddy Avatar answered Sep 14 '26 03:09

Pandikunta Anand Reddy


pkill -f celery

Run from the command line, this will kill at processes related to celery.

like image 27
huhh hhbhb Avatar answered Sep 14 '26 03:09

huhh hhbhb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!