芹菜未选择CELERY_ALWAYS_EAGER设置 [英] Celery not picking CELERY_ALWAYS_EAGER settings
问题描述
我正在运行Django 1.8 + Celery 4.0.2
Celery配置良好,可以在redis后端本地运行Django任务。
但是,当我尝试使用 CELERY_ALWAYS_EAGER = True
设置时,
无效。其他设置则不是这种情况,例如 CELERY_TIMEZONE
I am running Django 1.8 + Celery 4.0.2
Celery is configured well and can run my Django tasks locally on redis backend.
But when I try to use CELERY_ALWAYS_EAGER = True
settings,
this settings has no effect. Which is not the case with other settings, e.g. CELERY_TIMEZONE
具体来说,在 pdb
中,我看到 app.conf.task_always_eager
是 False
Specifically, in pdb
I see that app.conf.task_always_eager
is False
lib / python2.7 / site-packages / celery / app / task.py(520)apply_async()
因此,CELERY_ALWAYS_EAGER不会以某种方式出现,并且对app.conf.task_always_eager没有影响
lib/python2.7/site-packages/celery/app/task.py(520)apply_async() So somehow CELERY_ALWAYS_EAGER is not picked up and has no effect on app.conf.task_always_eager
pdb的更多信息:
> app.conf.get('CELERY_ALWAYS_EAGER')
> True
> app.conf.task_always_eager
> False
这是什么原因?我知道Celery 4.x正在从旧的设置名称过渡到新的设置,但是他们仍然承诺仍会使用旧的设置名称。
What can cause this? I know that Celery 4.x is in transition from old setting names to new ones, but they still promise old settings names still would be used as well.
推荐答案
CELERY_ALWAYS_EAGER
在版本4.0+中已重命名为 CELERY_TASK_ALWAYS_EAGER
。
CELERY_ALWAYS_EAGER
has been renamed to CELERY_TASK_ALWAYS_EAGER
in version 4.0+.
更准确地说,不建议使用全大写设置,而是直接配置celery应用程序对象,并且其中一些已命名为使用 task _
或 worker _
作为前缀。因为仍然具有全大写设置的向后兼容性,所以这也间接重命名了全大写设置。
More accurately, all-caps settings have been deprecated in favor of directly configuring the celery app object, and several have been namespaced to either use task_
or worker_
as a prefix. Because there's still backwards-compatability with all-caps settings, this indirectly renamed the all-caps setting as well.
来自更改日志:
celery_前缀也已删除,此名称空间中与任务相关的设置现在以task_为前缀,worker相关的设置带有worker _。
The celery_ prefix has also been removed, and task related settings from this name-space is now prefixed by task_, worker related settings with worker_.
这篇关于芹菜未选择CELERY_ALWAYS_EAGER设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!