The Python Oracle

Is there any way to change the Celery config programmatically, after app init?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Cosmic Puzzle

--

Chapters
00:00 Question
01:48 Accepted answer (Score 7)
02:20 Thank you

--

Full question
https://stackoverflow.com/questions/3636...

Accepted answer links:
[conf]: https://github.com/celery/celery/blob/v3...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #unittesting #testing #configuration #celery

#avk47



ACCEPTED ANSWER

Score 7


Simply changing variables on Celery's .conf object (an instance of Settings) works:

app.conf.CELERY_ALWAYS_EAGER = True

Although conf is indeed a @cached_property of Celery (in version 3.1.22 anyway), this caches the instance returned, not all the values - so the configuration is indeed dynamically updatable.