-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set collections for a library component [FC-0062] #35600
base: master
Are you sure you want to change the base?
feat: set collections for a library component [FC-0062] #35600
Conversation
Thanks for the pull request, @navinkarkera! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
@@ -824,7 +824,7 @@ openedx-filters==1.10.0 | |||
# -r requirements/edx/kernel.in | |||
# lti-consumer-xblock | |||
# ora2 | |||
openedx-learning==0.13.1 | |||
openedx-learning @ git+https://github.com/open-craft/openedx-learning@navin/component-collection-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
: update this after merging openedx/openedx-learning#238 releasing new version of openedx-learning
@@ -1373,7 +1373,7 @@ openedx-filters==1.10.0 | |||
# -r requirements/edx/testing.txt | |||
# lti-consumer-xblock | |||
# ora2 | |||
openedx-learning==0.13.1 | |||
openedx-learning @ git+https://github.com/open-craft/openedx-learning@navin/component-collection-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
: update this after merging openedx/openedx-learning#238 releasing new version of openedx-learning
@@ -983,7 +983,7 @@ openedx-filters==1.10.0 | |||
# -r requirements/edx/base.txt | |||
# lti-consumer-xblock | |||
# ora2 | |||
openedx-learning==0.13.1 | |||
openedx-learning @ git+https://github.com/open-craft/openedx-learning@navin/component-collection-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
: update this after merging openedx/openedx-learning#238 releasing new version of openedx-learning
@@ -1034,7 +1034,7 @@ openedx-filters==1.10.0 | |||
# -r requirements/edx/base.txt | |||
# lti-consumer-xblock | |||
# ora2 | |||
openedx-learning==0.13.1 | |||
openedx-learning @ git+https://github.com/open-craft/openedx-learning@navin/component-collection-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
: update this after merging openedx/openedx-learning#238 releasing new version of openedx-learning
c6736b8
to
eb7d2d1
Compare
from ..content.search.tasks import update_library_collection_index_doc | ||
for collection in affected_collections: | ||
update_library_collection_index_doc.delay(str(library_key), collection.key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trigger collection indexing asynchronously instead of relying on sync indexing via signals. See https://github.com/openedx/openedx-learning/pull/238/files#diff-50734dffd9d06d0a9cbc318f1b298dddd25968d064b515d716dc7a0023b7190bR660-R666
You can test the performance improvement by setting CELERY_ALWAYS_EAGER = False
in cms/envs/devstack.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice a performance improvement here (maybe I tested it wrong?).
This call is always in the 600ms - 2500ms range (which I agree is not good), but I don't think we should call the search tasks directly here. Maybe add another parameter to the LIBRARY_COLLECTION_UPDATED
event to define beforehand whether the task should run sync or async.
@bradenmacdonald, can you give us your insight here? I don't want to make things complicated near the version cut.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add another parameter to the LIBRARY_COLLECTION_UPDATED event to define beforehand whether the task should run sync or async.
Yes, that is better. I was probably feeling lazy to update the event as part of this ticket but seems like it is unavoidable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice a performance improvement here (maybe I tested it wrong?).
You need to add and remove multiple collections for a component to see the difference. Also set CELERY_ALWAYS_EAGER = False
to run celery tasks in worker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpenido Updated LibraryCollectionData
to include a field call lazy
and used it here instead.
93f436d
to
eb7d2d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thank you for your work, @navinkarkera!
- I tested this using the instructions from feat: manage collections in component sidebar [FC-0062] frontend-app-authoring#1373
- I read through the code
-
I checked for accessibility issuesN/A - Includes documentation
I added a small PR to circumvent the meilisearch bug below. It is missing some tests fixes:
Note
We have an unused endpoint that we created beforehand for handling components/collections here:
def update_components(self, request, *args, **kwargs) -> Response: |
from ..content.search.tasks import update_library_collection_index_doc | ||
for collection in affected_collections: | ||
update_library_collection_index_doc.delay(str(library_key), collection.key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice a performance improvement here (maybe I tested it wrong?).
This call is always in the 600ms - 2500ms range (which I agree is not good), but I don't think we should call the search tasks directly here. Maybe add another parameter to the LIBRARY_COLLECTION_UPDATED
event to define beforehand whether the task should run sync or async.
@bradenmacdonald, can you give us your insight here? I don't want to make things complicated near the version cut.
ce7f906
to
3e889a9
Compare
The indexing update is already handled by m2m_changed handler.
3e889a9
to
cd9eec9
Compare
e2f79fe
to
1debf71
Compare
1debf71
to
baa10fc
Compare
Using `get_collection_components` does not work in case of post_remove as the component is already removed from collection and we don't really need additional filtering as we already have pk_set from the signal.
Description
Adds api to set/update collections on a given component. Related to openedx/frontend-app-authoring#1373
Supporting information
Private-ref
: https://tasks.opencraft.com/browse/FAL-3848Depends on:
Testing instructions
See openedx/frontend-app-authoring#1373 for instructions.
Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information