Zorgan
Zorgan

Reputation: 9153

How to shutdown celery node

My celery log is showing this error:

UserWarning: A node named celery@postr is already using this process mailbox!

Maybe you forgot to shutdown the other node or did not do so properly?
Or if you meant to start multiple nodes on the same host please make sure
you give each node a unique node name!

  warnings.warn(W_PIDBOX_IN_USE.format(node=self))

How can I shutdown the other node?

PS: Is there a way to see all the current running nodes?

Upvotes: 10

Views: 1698

Answers (2)

gravlax
gravlax

Reputation: 80

I had the same issue, this may be because you didn't set hostnames to your different nodes. This is needed to let celery distinct them.

According to the doc mentionned by @Rune, you should launch multiple nodes with different hostnames through -n param:

celery -A proj worker --loglevel=INFO --concurrency=10 -n worker1@%h
celery -A proj worker --loglevel=INFO --concurrency=10 -n worker2@%h
celery -A proj worker --loglevel=INFO --concurrency=10 -n worker3@%h

where %h means hostname, including domain name.

Note: If you are using supervisor, the % sign must be escaped by adding a second one %%h, e.g. -n worker1@%%h

Upvotes: 0

Rune Kaagaard
Rune Kaagaard

Reputation: 6798

Assuming you are on a unix, you can see the running processes with:

ps aux | grep celery

This will show you as list of the running process ids, eg. 1111, 2222 and 3333. You can then shut down the celery processes by sending the TERM signal:

kill -TERM 1111 2222 3333

Depending on your configuration your celery process might spawn several subprocesses and you can see the parent process id in something like /var/run/celery.pid

See: https://docs.celeryproject.org/en/stable/userguide/workers.html#stopping-the-worker

Upvotes: 2

Related Questions