Reputation: 3035
From what I have seen, the task state depends entirely on the value set for CELERY_TASK_RESULT_EXPIRES - if I check the task state within this interval after the task has finished executing, the state returned by:
AsyncResult(task_id).state
is correct. If not, the state will not be updated and will remain forever PENDING.
Can anyone explain me why does this happen? Is this a feature or a bug? Why is the task state depending on the result expiry time, even if I am ignoring results?
(Celery version: 3.0.23, result backend: AMQP)
Upvotes: 5
Views: 3138
Reputation: 19499
State and result is the same. The result backend was initially used to store return values then it was extended to store arbitrary states. The term result was not sufficient anymore as it implies that the task has completed. ignore_result
should be ignore_state
, but we haven't had the chance to rename that yet. I have a plan to clean up the terminology used here, but it will take some time to be backward compatible.
Upvotes: 7