Skip to content

Commit

Permalink
Contains a workaround for the capitalized configuration issue (celery…
Browse files Browse the repository at this point in the history
…#6385)

* Contains a workaround for the capitalized configuration issue

* Update celery/apps/worker.py

Co-authored-by: Omer Katz <omer.drow@gmail.com>

* Update celery/apps/worker.py

Co-authored-by: Omer Katz <omer.drow@gmail.com>

Co-authored-by: Omer Katz <omer.drow@gmail.com>
  • Loading branch information
2 people authored and jeyrce committed Aug 25, 2021
1 parent 93732e1 commit a4e7efe
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions celery/apps/worker.py
Expand Up @@ -141,12 +141,25 @@ def on_start(self):
app.log.redirect_stdouts(self.redirect_stdouts_level)

# TODO: Remove the following code in Celery 6.0
if app.conf.maybe_warn_deprecated_settings():
logger.warning(
"Please run `celery upgrade settings path/to/settings.py` "
"to avoid these warnings and to allow a smoother upgrade "
"to Celery 6.0."
)
# This qualifies as a hack for issue #6366.
# a hack via app.__reduce_keys__(), but that may not work properly in
# all cases
warn_deprecated = True
config_source = app._config_source
if isinstance(config_source, str):
# Don't raise the warning when the settings originate from
# django.conf:settings
warn_deprecated = config_source.lower() not in [
'django.conf:settings',
]

if warn_deprecated:
if app.conf.maybe_warn_deprecated_settings():
logger.warning(
"Please run `celery upgrade settings path/to/settings.py` "
"to avoid these warnings and to allow a smoother upgrade "
"to Celery 6.0."
)

def emit_banner(self):
# Dump configuration to screen so we have some basic information
Expand Down

0 comments on commit a4e7efe

Please sign in to comment.