How to restart Celery gracefully without delaying tasks

前端 未结 7 576
面向向阳花
面向向阳花 2020-12-24 07:14

We use Celery with our Django webapp to manage offline tasks; some of these tasks can run up to 120 seconds.

Whenever we make any code modifications, we need to rest

7条回答
  •  我在风中等你
    2020-12-24 07:37

    Can you launch it with a custom pid file name. Possibly timestamped, and key off of that to know which PID to kill?

    CELERYD_PID_FILE="/var/run/celery/%n_{timestamp}.pid"

    ^I dont know the timestamp syntax but maybe you do or you can find it?

    then use the current system time to kill off any old pids and launch a new one?

提交回复
热议问题