djangoceleryceleryd

How do I restart celery workers gracefully?


While issuing a new build to update code in workers how do I restart celery workers gracefully?

Edit: What I intend to do is to something like this.


Solution

  • According to https://docs.celeryq.dev/en/stable/userguide/workers.html#restarting-the-worker you can restart a worker by sending a HUP signal

     ps auxww | grep celeryd | grep -v "grep" | awk '{print $2}' | xargs kill -HUP