-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: Skip unpublished units/blocks from completion stats #37247
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
fix: Skip unpublished units/blocks from completion stats #37247
Conversation
|
Thanks for the pull request, @marslanabdulrauf! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are 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. DetailsWhere 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. |
|
Can you add a test for this? Can @asadali145 or @Anas12091101 do a more thorough review? |
9f6bb16 to
83a754e
Compare
|
I would let Asad/Anas review this but I had one thing in mind, How would it work in case of existing courses that have existing cache? |
|
Thanks @arslanashraf7 for pointing this out. We need to re-create/update cache for all courses once we merge this using management command: |
|
@bradenmacdonald would you be willing to take a look at this bug fix for completion? Let us know if it needs further description, since the linked issue isn't public, and relies on courses that aren't public. |
|
I'm a bit confused here... shouldn't the block structures be generated exclusively from the published branch of the modulestore (and if they're not already, shouldn't they be fixed to be)? I don't understand why we would ever be building course blocks from the draft branch. |
|
If the fundamental problem is that this is evaluating user completion of a content state that they're not seeing (because it's draft), then even this fix will have gaps in it. For instance, what happens when you've moved a component from one place to another in the draft but haven't published it? It will aggregate into the wrong containers for that user. Maybe it's an artifact of the fact that the collect phase of block structures used to happen only in LMS workers, and so we didn't explicitly specify the published branch when doing content data collection? |
I checked and found that we have ALTERNATE_ENV_TASKS for block_structure and they are supposed to cache the block structure in LMS env which means they shouldn't be caching from draft branch 🤔 We have celery_route defined for both apps so when we get this task in CMS we want LMS worker/queue to run it in LMS however as we are still in CMS env will this code chunk get the CELERY_QUEUES matching I haven't tested this part yet. |
Verified => We have ALTERNATE_WORKER_QUEUE defined and I verified that the update_course_in_cache are being run in LMS workers with Looking into any possibility where we might be caching the content using |
|
Is it possible that it's some sort of race condition where it's reading the older published state from one of the other MongoDB instances in the replica set before the writes have a chance to propagate? |
Could be, but still LMS should only get |
|
There has been some development, I am unable to reproduce it locally now with proper celery setup. I went through the tasks and there is no task on CMS side to cache the blocks except the one which we have mapped to run in If for any reason this task gets executed in CMS then we get draft branch block structure which caused this issue. We can mark this PR as draft/stale till we figure out if its related to edX core. |
|
Could you please create a PR to explicitly read from the published branch so that we always get the right version regardless of which process reads it? |
Yeah sure. |
|
@marslanabdulrauf this can be closed, right? |
|
yes |
|
Closing this PR as the underlying issue is fixed in another PR |
Related Ticket
https://github.com/mitodl/hq/issues/8050
Important 💥
For all courses (with already cached block structure) we need to refetch and update the block structure using a management command:
Description
We are storing the cache for course outline from CMS and using the same cache in LMS and there were some problems.
unpublishedcomponentcourse_outlinefrom cache (which CMS set) and it includeunpublishedcomponent whose completion will always be 0.0unpublishedcomponent and at that point progress is marked completed on home page -- However if something changes on CMS side and it overrides the cache we will again seenot completedissueThis PR:
published_onfield for xblock in BlockCompletionTransformerunpublishedcomponentTesting instructions
masterbranchmarslan/8050-skip-unpublished-from-completion-statsNOTES:
Make sure to test user progress page, grading and instructor dashboard as well to see if they are working as expected