pythondjangocelerydjango-celeryflower

How to restart running task and pending task in celery once worker is forcefully shutdown?


Currently i am running task in celery which take 10 to 15 minutes to complete but problem is How do i restart task which currently running in worker and also one which is currently not running but waiting for task to run while i forcefully stopped worker or in case my server got crash or stopped. What happens right now is if i start celery again it's not starting the last running task or remaining task.


Solution

  • one thing you can do is enable acks_late on the task. Additionally, it's probably worthwhile to read their FAQ section on acks late and retry.

    @app.task(acks_late=True)
    def task(*args, **kwargs):
        ...