fix: add CELERY_RESULT_BACKEND with default django-cache - #6720
Conversation
|
Thanks for the pull request, @navinkarkera! I've created OSPR-6621 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
|
@navinkarkera Thank you for your contribution. Is this ready for our review? |
|
Hi @natabene ! This is not ready for your review yet. I'll ping you here once ready. |
| CELERY_BROKER_VHOST: '' | ||
| CELERY_EVENT_QUEUE_TTL: null | ||
| CELERY_TIMEZONE: UTC | ||
| CELERY_RESULT_BACKEND: django-cache |
There was a problem hiding this comment.
Why are we overriding this here for dockers ?
There was a problem hiding this comment.
@kaustavb12 As per my understanding, these files contain all available settings for the deployment which user can override if required.
Also it is set to the default value django-cache. Let me know if we need to remove this.
There was a problem hiding this comment.
@navinkarkera
From what I understand, these files are meant to override some of the settings from the playbooks, in context of docker. I think this would prevent anyone from changing the value to anything else using the ansible settings.
And we have setup default value to django-cache anyways.
There was a problem hiding this comment.
@kaustavb12 We can remove it, but I am trying to get a clear picture of the settings here.
I can see that we have all kinds of settings in this file, for example: CELERY_BROKER_TRANSPORT: amqp. Does this mean we cannot override this in local docker setup as it is fixed here?
Also, we have an additional file specifically for overrides called ansible_overrides.yml in the same folder.
There was a problem hiding this comment.
@navinkarkera Sorry for all the back and forth here, but I am trying to make sure all the changes we make here are justified.
As per my understanding, these files contain all available settings for the deployment which user can override if required.
I checked how the env settings work in the context of the devstack and you were right, these values are just initial defaults which can in-fact be overriden by both ansible and by the user as required.
I think this is how it works:
- The
lms.ymlfile provides base meaningful defaults for the docker setup which are first copied over to the container. - The ansible playbooks are then run, which overrides these vaules in the
lms.ymlfile. Case in point, theCELERY_BROKER_TRANSPORTvariable which you pointed out. The default value inlms.ymlisamqp, but the default value in ansible isredis. The vaule for the same in devstack is alsoredis. - As you rightly pointed out, the values for overriding the defaults of the ansible are provided by ansible_overrides.yml along with other files like devstack_common_ansible_overrides.yml.
- During runtime, these values are picked up by
production.pyand can in-turn be overridden bydevstack.py.
In this context, setting this value here, does no harm but does not serve any purpose either, since we anyways have defaults setup in both ansible and in production.py.
Let me know what you think, or if I have missed understood the flow somewhere.
There was a problem hiding this comment.
Sorry for all the back and forth here, but I am trying to make sure all the changes we make here are justified.
No need to be sorry, in fact it helps us clear our misunderstandings about these files.
In this context, setting this value here, does no harm but does not serve any purpose either, since we anyways have defaults setup in both ansible and in production.py.
I think it would be useful to keep it in these files as a way of documenting possible configuration fields for docker.
Let me know if you feel differently.
There was a problem hiding this comment.
I think it would be useful to keep it in these files as a way of documenting possible configuration fields for docker.
Let me know if you feel differently.
We don't maintain such defaults list for documentation purposes, for the native install, and I personally don't see too many benefits of maintaining a redundent set of defaults for docker which get overwritten by ansible anyways.
However, since we are maintaining the defaults for other variables, I am approving this for now, and leaving it at your discretion if you want to retain it.
| CELERY_BROKER_VHOST: '' | ||
| CELERY_EVENT_QUEUE_TTL: null | ||
| CELERY_TIMEZONE: UTC | ||
| CELERY_RESULT_BACKEND: django-cache |
| All notable changes to this project will be documented in this file. | ||
| Add any new changes to the top (right below this line). | ||
|
|
||
| - 2022-04-14 |
There was a problem hiding this comment.
I think this date needs to be bumped to when the PR will be merged.
There was a problem hiding this comment.
@kaustavb12 So we need to update this after the PR is approved?
There was a problem hiding this comment.
@navinkarkera On second thought could you please bump the dates now, as you might not get a chance to do so after its upstream approved.
Also please do so for the corresponding release branch PRs
|
👍 Looks good to go from my end.
|
|
@natabene This is ready for your review. |
|
@navinkarkera I kicked off the tests, let's see how they turn out. |
0340325 to
6c0c175
Compare
|
Thanks @natabene, Just updated the commit message to fix commit lint error. |
6c0c175 to
85c1327
Compare
|
@natabene I resolved the conflicts and updated the MR. Please kick off the tests and review. |
85c1327 to
662469b
Compare
|
@navinkarkera Sure, it has been lined for a review with the appropriate team. |
|
@navinkarkera could you resolve merge conflicts with master? I can't merge the PR without it. |
|
@kaustavb12 can you get the merge conflicts resolved so that I can merge it? |
|
@NIXKnight Sorry for the delay. I'll resolve them and update the MR. |
662469b to
451eb73
Compare
|
@NIXKnight Updated. Thanks! |
|
@navinkarkera 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Configuration Pull Request
Note: This PR has a corresponding edx-platform PR openedx/openedx-platform#30244
Description
At Opencraft, we want to run multiple instances of celery workers in separate servers. The celery workers need to be able to share task results. Currently, the
CELERY_RESULT_BACKENDis hard coded to usedjango-cache.So this PR allows to setup
CELERY_RESULT_BACKENDvia configuration.To use django ORM as celery backend, one can set
CELERY_RESULT_BACKENDtodjango-dbas described in docs.Supporting information
Deadline
"None"