Search code examples
pythonredisceleryestimation

Celery best way manage/get eta of task


I want to get eta of task in celery each time with get request. There is no direct api in celery to get task scheduled time (except inspect() - but it's seems very costly to me)

How can i manage eta of particular task? The downside of storing eta time in Django model is not consistent ( either i couldnt store taks_id because i can't - dont know how get eta from task_id)

I see on one question that there is no api, cause it somehow depends on brokers and etc. But i hope that there is some solution

So what's the best way manage task_id to get eta?

Backend and broker is redis


Solution

  • I don't think there is a magic way to do this.

    What I do in my app is just log the execution time for each task and return that as an ETA. If you wanted to get a little more accurate you could also factor in the redis queue size and the task consumption rate.