Setting acks_late=True doesnt re-execute the task if worker process is killed

i want to reproduce this behaviour highlighted in celery doc

If the worker won’t shutdown after considerate time, for being stuck in an infinite-loop or similar, you can use the KILL signal to force terminate the worker: but be aware that currently executing tasks will be lost (i.e., unless the tasks have the acks_late option set).

this is my task:

@shared_task(
    name='CHECK_ACK',
    acks_late=True,
)
def check_ack():
    print('task picked')
    time.sleep(60)
    print('task completed after 60r seconds')

here are steps i am following: 1.start celery: celery -A master worker --concurrency=2
2.run the task from django shell: check_ack.delay()
3. while task is running execute :pkill -9 -f 'master worker'
4. now restart celery again : celery -A master worker --concurrency=2

But i don't see the task getting re-picked by workers. What am i missing?

Вернуться на верх