Skip to content
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

Add Django settings flags to roll out the extracted XBlocks #35549

Merged
merged 7 commits into from
Dec 2, 2024

Conversation

farhan
Copy link
Contributor

@farhan farhan commented Sep 26, 2024

Add Waffle flags to roll out the extracted XBlocks
Flags will use to toggle between the old and new block quickly
without putting course content or user state at risk.

Ticket: #35308

Django Settings Flags

Following built in blocks wafffle flags are in action in this PR and has been implemented:

  • word_cloud
  • annotatable
  • poll_question
  • lti
  • html
  • discussion
  • problem
  • video

@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 2 times, most recently from cabc843 to 64cf575 Compare October 2, 2024 09:31
@farhan farhan changed the title Test PR Add Waffle flags to roll out the extracted XBlocks Oct 2, 2024
@farhan farhan marked this pull request as ready for review October 2, 2024 10:02
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 3 times, most recently from 4ed8c6d to 34d042c Compare October 14, 2024 08:59
@farhan farhan linked an issue Oct 14, 2024 that may be closed by this pull request
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 2 times, most recently from cca34ec to b2dcc10 Compare October 16, 2024 16:17
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 2 times, most recently from 833b935 to 9820dd6 Compare October 27, 2024 06:38
@farhan farhan closed this Oct 28, 2024
@farhan farhan reopened this Oct 28, 2024
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 3 times, most recently from 9eb768c to 84aba33 Compare October 31, 2024 08:38
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch from 84aba33 to 73ddfa0 Compare November 6, 2024 07:07
@farhan farhan added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Nov 6, 2024
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch from a2e4584 to 73ddfa0 Compare November 6, 2024 08:15
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 4 times, most recently from 681020d to 6c91c56 Compare November 7, 2024 11:43
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

xmodule/toggles.py Outdated Show resolved Hide resolved
@kdmccormick
Copy link
Member

It looks like you had to correct various tests because the name of the class changed. Is the name of the class also going to show up in exports or other serializations? If so, we should not update the name here or update the name back to preserve the name in serializations.

This is a good thing to keep in mind when changing the names of any classes which are persisted to the DB. In this particular case, though, I think we are OK. As far as I know, there are no features that depend on the literal class name of the block. The names that are used in de/serialization are the tag name(s) (problem, video, etc.) that each block is mapped to in setup.py.

Looking through the test cases which were updated, it seems that they were checking the class name rather than the class itself only because the class itself (BlahBlockWithMixins) is generated on-the-fly by mixologist.

@kdmccormick
Copy link
Member

@farhan Taking a look at your screenshot, it seems that either some CSS or JS (or both) is missing. And if you are able to still submit the problem's answer successfully, then that would imply that the JS is present, and that only the CSS is missing.

If you haven't already, try re-building static assets (npm run build-dev within tutor dev run lms bash). If that doesn't work, then I imagine that we have broke something which maps the builtin block classes to their corresponding static assets.

@kdmccormick
Copy link
Member

One fix you could try, related to @feanil 's comment earlier, would be setting __name__ on the built-in class after its definition:

_BuiltInProblemBlock.__name__ = "ProblemBlock"

This essentially tells Python "From the perspective of the module, the class goes by one name (_BuiltInProblemBlock), but I want it to appear to other objects as if it has a different name (ProblemBlock)".

@farhan
Copy link
Contributor Author

farhan commented Nov 26, 2024

@kdmccormick Thanks for sharing thoughts

  1. Related to exporting of course, xblocks are exporting fine as they are using tags rather than xblock class names
  2. I have checked again even rebuilding assets via npm run build is not fixing UI issue (Problems, Video)
  3. Running ./manage.py lms collectstatic is not fixing the ui either
  4. CSS files are generated and present but they are not linking correctly or reading css from the required files
  5. Problem is submitting and checked status exist even on reloading page
  6. When I run the same assets on master branch, UI/styling fixes.

Next:

  • So my as per my analysis, we needs to look into why css files are not linking correctly after changing of class names.
  • Check the effectiveness of following solution:
    _BuiltInProblemBlock.__name__ = "ProblemBlock"

@kdmccormick
Copy link
Member

kdmccormick commented Nov 26, 2024

Sounds good @farhan . You may already know this, but just in case: if you are running on tutor dev, then you will want to use npm run build-dev rather than npm run build. If you are running tutor local, then npm run build is appropriate.

@farhan
Copy link
Contributor Author

farhan commented Nov 26, 2024

Sounds good @farhan . You may already know this, but just in case: if you are running on tutor dev, then you will want to use npm run build-dev rather than npm run build. If you are running tutor local, then npm run build is appropriate.

I had tried npm run build-dev as well.

@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch 3 times, most recently from ee8a459 to 8d99d1b Compare November 26, 2024 17:45
@farhan
Copy link
Contributor Author

farhan commented Nov 27, 2024

PR is available for code review.
Problem and Video Blocks are rendering normal after following change.
https://github.com/openedx/edx-platform/pull/35549/files#diff-2adcf1a5ddc155e832aeab0472da97156e8487a683da9f786198332367eacc20R2519

I have reverted the test case fixing commit.

@farhan farhan requested review from kdmccormick and feanil November 27, 2024 09:07
farhan and others added 7 commits December 2, 2024 19:08
chore: Update xblocks-contrib pypi package

Commit generated by workflow `openedx/edx-platform/.github/workflows/upgrade-one-python-dependency.yml@refs/heads/farhan/waffle-flag-for-extracted-xblock`
@farhan farhan force-pushed the farhan/waffle-flag-for-extracted-xblock branch from 942db0a to 4360d9b Compare December 2, 2024 14:08
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Good work. I have not tested it myself but I see that you have.

@@ -498,3 +498,4 @@ def safe_parse_date(date):
_ExtractedHtmlBlock if settings.USE_EXTRACTED_HTML_BLOCK
else _BuiltInHtmlBlock
)
HtmlBlock.__name__ = "HtmlBlock"
Copy link
Member

Choose a reason for hiding this comment

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

We need to ensure that the HTML subclasses (CourseInfoBlock, AboutBlock, and StaticTabBlock) are based on the extracted HTML block code rather than the built-in code, as they are now. This may require exposing a new HTMLMixin class from xblocks-contrib.

This can be done in a follow-up.

@farhan farhan changed the title Add Waffle flags to roll out the extracted XBlocks Add Django settings flags to roll out the extracted XBlocks Dec 2, 2024
@farhan farhan merged commit f9126bf into master Dec 2, 2024
51 checks passed
@farhan farhan deleted the farhan/waffle-flag-for-extracted-xblock branch December 2, 2024 15:38
salman2013 pushed a commit to salman2013/edx-platform that referenced this pull request Dec 2, 2024
…35549)

chore: Add Django settings flags to roll out the extracted XBlocks
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

irtazaakram pushed a commit that referenced this pull request Dec 5, 2024
chore: Add Django settings flags to roll out the extracted XBlocks
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.

Add Django Settings to roll out extracted XBlocks
7 participants