Search code examples
pythondistributedcelerycelery-task

Retry a task in celery by task id


I've launched a lot of tasks, but some of then hasn't finished (763 tasks), are in a PENDING state, but the system isn't processing anything... It's possible to retry this tasks giving celery the task_id?


Solution

  • You can't. You can retry a task only from inside itself, you can't do it from outside.

    The best thing to do in this case is to run again the task type with the same args, in this way you will do the same JOB but with a new PID that identify your process/task.

    Remember also that the celery PENDING state not means only that the task is waiting for execution, but maybe that is unknown.

    http://celeryq.org/docs/userguide/tasks.html#pending

    I hope this could help