Celery task state depends on CELERY_TASK_RESULT_EXPIRES

帅比萌擦擦* 提交于 2019-12-07 06:36:50

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/19316133/celery-task-state-depends-on-celery-task-result-expires

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!