readthedocs.org
43930cc8 - Migrate Celery settings to new format with CELERY_ namespace (#12622)

Commit
13 days ago
Migrate Celery settings to new format with CELERY_ namespace (#12622) Celery 6.x will drop support for deprecated settings and require explicit `CELERY` namespace prefix. This migrates all settings to the new lowercase format. ### Changes - **worker.py**: Add `namespace="CELERY"` to `config_from_object()`: ```python application.config_from_object("django.conf:settings", namespace="CELERY") ``` - **Settings renamed** (base.py, test.py, docker_compose.py): - `CELERY_ALWAYS_EAGER` → `CELERY_TASK_ALWAYS_EAGER` - `CELERYD_TASK_TIME_LIMIT` → `CELERY_TASK_TIME_LIMIT` - `CELERYD_HIJACK_ROOT_LOGGER` → `CELERY_WORKER_HIJACK_ROOT_LOGGER` - `CELERYD_PREFETCH_MULTIPLIER` → `CELERY_WORKER_PREFETCH_MULTIPLIER` - `CELERY_ACKS_LATE` → `CELERY_TASK_ACKS_LATE` - `CELERY_IGNORE_RESULT` → `CELERY_TASK_IGNORE_RESULT` - `CELERY_CREATE_MISSING_QUEUES` → `CELERY_TASK_CREATE_MISSING_QUEUES` - `CELERY_DEFAULT_QUEUE` → `CELERY_TASK_DEFAULT_QUEUE` - `CELERYBEAT_SCHEDULER` → `CELERY_BEAT_SCHEDULER` - `CELERYBEAT_SCHEDULE` → `CELERY_BEAT_SCHEDULE` - `BROKER_URL` → `CELERY_BROKER_URL` - `BROKER_TRANSPORT_OPTIONS` → `CELERY_BROKER_TRANSPORT_OPTIONS` - **Code references updated**: - `core/utils/tasks/public.py`: `settings.CELERY_TASK_ALWAYS_EAGER` - `core/tasks.py`: `settings.CELERY_BROKER_URL` Refs: https://docs.celeryq.dev/en/stable/userguide/configuration.html#new-lowercase-settings <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Migrate celery settings to new ones</issue_title> > <issue_description>Celery 6.x will drop support for some deprecated settings, and it will require to explicitly set `CELERY` as the prefix. > > https://docs.celeryq.dev/en/stable/userguide/configuration.html#new-lowercase-settings > > They do provide a tool for renaming the settings, but we should also check for settings set from the ops repos. > > https://docs.celeryq.dev/en/stable/history/whatsnew-4.0.html#latentcall-django-admonition > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@humitos</author><body> > We are already using `CELERY_` prefix in all our settings, so it seems we only need to update how we load them at https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/worker.py#L18 > > ```diff > diff --git a/readthedocs/worker.py b/readthedocs/worker.py > index 527ee509b..8a2de7dac 100644 > --- a/readthedocs/worker.py > +++ b/readthedocs/worker.py > @@ -15,7 +15,7 @@ def create_application(): > ) > > application = Celery(settings.CELERY_APP_NAME) > - application.config_from_object("django.conf:settings") > + application.config_from_object("django.conf:settings", namespace='CELERY') > application.autodiscover_tasks(None) > > # A step to initialize django-structlog > ``` > > We need to do the same on commercial. > > I put this in Q4, but I'm not sure _when_ Celery 6.x is going to be released. Maybe we can already make this change, tho.</body></comment_new> > <comment_new><author>@stsewd</author><body> > We are using the `CELERYD` prefix for some settings</body></comment_new> > </comments> > </details> - Fixes readthedocs/readthedocs.org#12490 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: humitos <244656+humitos@users.noreply.github.com>
Author
Parents
Loading