Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
858 views
in Technique[技术] by (71.8m points)

python - Celery not picking CELERY_ALWAYS_EAGER settings

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

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() So somehow CELERY_ALWAYS_EAGER is not picked up and has no effect on app.conf.task_always_eager

More info from pdb:

> app.conf.get('CELERY_ALWAYS_EAGER')
> True
> app.conf.task_always_eager
> False

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

CELERY_ALWAYS_EAGER has been renamed to CELERY_TASK_ALWAYS_EAGER in version 4.0+.

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.

From the changelog:

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_.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...