M
M
mx60012017-07-12 00:40:33
Python
mx6001, 2017-07-12 00:40:33

Why doesn't Celery resume the failed task after starting?

I send a task through delay and put sleep(20) in it, at the end I write a flag in the database.
After starting (I see that Celery started to execute), I immediately kill Celery (I close the console and it does SIGKILL), then I start it again, but it does not perform this task again. What could be the reason? After all, he did not complete the task.

app = Celery('tasks', broker='pyamqp://[email protected]//')

@app.task
def add():
    time.sleep(20)
    # Здесь код вставки в ДБ

launch
tasks.add.delay()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2017-07-12
@mx6001

I don't understand why you got the idea that the task should continue to run. The worker pulled a task from the queue. If after that he suddenly died, she will not return to the queue.
For proper stopping of workers so that they do not die in the middle of performing tasks, read the docs: docs.celeryproject.org/en/latest/userguide/workers...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question