1

I am running celery via redis. I start my worker like this:

celery multi start worker1 -A mypackage.tasks.tasks
celery multi v3.1.18 (Cipater)
> Starting nodes...
        > worker1@polyphemus.xxx.net: OK

And I kill it like this:

celery multi kill worker1
celery multi v3.1.18 (Cipater)
> worker1@polyphemus.xxx.net: DOWN

But the worker is actually still running. I can not start the worker again:

celery multi start worker1 -A mypackage.tasks.tasks
celery multi v3.1.18 (Cipater)
> Starting nodes...
ERROR: Pidfile (worker1.pid) already exists.
Seems we're already running? (pid: 29369)
        > worker1@polyphemus.xxx.net: OK

If I kill the process, everything is ok:

kill 29369

But that is too cumbersome: I need to know the PID. How to really kill the worker with the celery command line tool?

blueFast
  • 4,000
  • 13
  • 36
  • 51

1 Answers1

3

There's no way to stop the worker with celery multi command. You can get PID from pid file or from ps output, e.g.

ps auxww | grep '[c]elery worker' | awk '{print $2}' | xargs kill 

or

kill $(cat /path/to/worker.pid)
DukeLion
  • 3,239
  • 1
  • 17
  • 19
  • 1
    What?! According to the `celery multi` help message, *there is* a `celery multi kill worker1` command. What is that supposed to do but to kill the worker? – blueFast Sep 29 '15 at 09:29
  • http://celery.readthedocs.org/en/latest/userguide/workers.html#stopping-the-worker - it's not documented. I've checked with the source code, it does exactly the same but in python. – DukeLion Sep 29 '15 at 10:52
  • 1
    That command actually does nothing. Try it and see. After `celery multi kill` you will still see the processes running... – DejanLekic Jun 24 '16 at 13:51