Celery任务状态取决于CELERY

Celery任务状态取决于CELERY

本文介绍了Celery任务状态取决于CELERY_TASK_RESULT_EXPIRES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

从我看到的情况来看,任务状态完全取决于为CELERY_TASK_RESULT_EXPIRES设置的值-如果我在任务完成执行后的此间隔内检查任务状态,则返回的状态为:

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版本:3.0.23,结果后端:AMQP)

(Celery version: 3.0.23, result backend: AMQP)

推荐答案

状态和结果相同.结果后端最初用于存储返回值,然后扩展为存储任意状态.结果一词不再足够,因为它暗示任务已完成. ignore_result应该是ignore_state,但是我们还没有机会对其进行重命名.我已经计划清理这里使用的术语,但是向后兼容需要一些时间.

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.

这篇关于Celery任务状态取决于CELERY_TASK_RESULT_EXPIRES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 22:53