Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

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():

    application.config_from_object("django.conf:settings", namespace="CELERY")
  • Settings renamed (base.py, test.py, docker_compose.py):

    • CELERY_ALWAYS_EAGERCELERY_TASK_ALWAYS_EAGER
    • CELERYD_TASK_TIME_LIMITCELERY_TASK_TIME_LIMIT
    • CELERYD_HIJACK_ROOT_LOGGERCELERY_WORKER_HIJACK_ROOT_LOGGER
    • CELERYD_PREFETCH_MULTIPLIERCELERY_WORKER_PREFETCH_MULTIPLIER
    • CELERY_ACKS_LATECELERY_TASK_ACKS_LATE
    • CELERY_IGNORE_RESULTCELERY_TASK_IGNORE_RESULT
    • CELERY_CREATE_MISSING_QUEUESCELERY_TASK_CREATE_MISSING_QUEUES
    • CELERY_DEFAULT_QUEUECELERY_TASK_DEFAULT_QUEUE
    • CELERYBEAT_SCHEDULERCELERY_BEAT_SCHEDULER
    • CELERYBEAT_SCHEDULECELERY_BEAT_SCHEDULE
    • BROKER_URLCELERY_BROKER_URL
    • BROKER_TRANSPORT_OPTIONSCELERY_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

Original prompt

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)

@humitos 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 --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.</comment_new>
<comment_new>@stsewd
We are using the CELERYD prefix for some settings</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Migrate celery settings to new configuration Migrate Celery settings to new format with CELERY_ namespace Dec 1, 2025
Copilot AI requested a review from humitos December 1, 2025 11:20
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after answering my question.

Also, we need to check the settings in https://github.com/readthedocs/readthedocs-ops and https://github.com/readthedocs/readthedocs-corporate-ops and migrate them as well. @copilot can you do that?

Copy link
Contributor Author

Copilot AI commented Dec 1, 2025

Looks good after answering my question.

Also, we need to check the settings in https://github.com/readthedocs/readthedocs-ops and https://github.com/readthedocs/readthedocs-corporate-ops and migrate ...

I can only work on the current repository (readthedocs.org). I don't have access to the readthedocs-ops and readthedocs-corporate-ops repositories. Someone with access to those repos will need to migrate the settings there using the same naming conventions from this PR.

Copilot AI requested a review from humitos December 1, 2025 11:43
@humitos
Copy link
Member

humitos commented Dec 1, 2025

Also, we need to check the settings in readthedocs/readthedocs-ops and readthedocs/readthedocs-corporate-ops and migrate them as well. @copilot can you do that?

I checked in -ops repositories and opened:

@humitos humitos marked this pull request as ready for review December 1, 2025 14:38
@humitos humitos requested a review from a team as a code owner December 1, 2025 14:38
@humitos humitos requested review from a team and stsewd December 1, 2025 14:39
@humitos
Copy link
Member

humitos commented Dec 2, 2025

We can merge this after today's deploy, so we have a full week to test it locally just in case.

@humitos
Copy link
Member

humitos commented Dec 9, 2025

Well, we didn't merge this for this deploy, but that's fine. We don't want to deal with Celery issues during Xmas 😄 . I add this PR to one of the first sprints of 2026.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate celery settings to new ones

3 participants