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

Test PR | Enable Extracted Word Cloud #35983

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

farhan
Copy link
Contributor

@farhan farhan commented Dec 7, 2024

It's the test PR for this xblocks-contrib repo PR

Steps done in this PR:

  1. Enabled Extracted Block in lms/envs/common.py settings
  2. Enable fail-fast: false in .github/workflows/unit-tests.yml
  3. Replace pip installed version of xblocks-contrib with following git branched installation.
git+https://github.com/openedx/xblocks-contrib.git@farhan/word-cloud-xblock

PR sandbox

Username: openedx
PW: openedx

Settings

TUTOR_GROVE_COMMON_SETTINGS: |
  USE_EXTRACTED_WORD_CLOUD_BLOCK: false

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 8cf696a to 988cb0c Compare January 13, 2025 14:28
@farhan farhan closed this Jan 15, 2025
@farhan farhan reopened this Jan 15, 2025
@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch 4 times, most recently from ad5a8b7 to 02848a2 Compare January 16, 2025 10:40
@farhan farhan marked this pull request as ready for review January 16, 2025 11:09
@farhan farhan closed this Jan 17, 2025
@farhan farhan reopened this Jan 17, 2025
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

I took a pass but since I'm not as familiar with the Xblock framework, forgive me if some of the questions have obvious answers. I'm in particular confused about why the tests need to change and if that indicates any sort of breakage that we need to handle elsewhere?

'element_id': self.block.location.html_id(),
'num_inputs': 5, # default value
'submitted': False, # default value,
}

assert fragment.content == self.runtime.render_template('word_cloud.html', expected_context)
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
expected_context['range_num_inputs'] = range(5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not check the block type in this case?

Copy link
Contributor Author

@farhan farhan Jan 22, 2025

Choose a reason for hiding this comment

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

Fixed, checking for both (Builtin & Extracted) XBlocks now.

if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
def_id = runtime.id_generator.create_definition(olx_element.tag, olx_element.get('url_name'))
keys = ScopeIds(None, olx_element.tag, def_id, runtime.id_generator.create_usage(def_id))
block = WordCloudBlock.parse_xml(olx_element, runtime, keys)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do keys need to be provided for one instantiation but not the other?

Copy link
Contributor Author

@farhan farhan Jan 22, 2025

Choose a reason for hiding this comment

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

Update:
I have added keys for both builtin and extracted implementation to avoid If condition.

Why It's not needed in case of builtin xblock implementation?
In BuiltIn xblock implementation WordCloud block has XmlMixin and in its parse_xml method implementation, there is a check at start that if keys are None then it creates the keys.
I have copied the same lines of code and added them in test case.
In Extracted XBlock implementation parse_xml method of xblocks/core.py calls which doesn't have this check and expecting keys values in params.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Further discussion:
#35983 (comment)

# This will export the olx to a separate file.
block.add_xml_to_node(node)
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
filepath = 'word_cloud/block_id.xml'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the same method as below to export the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because add_xml_to_node is defined in XmlMixin class.
BuiltIn XBlocks are using this mixin

In Extracted XBlocks we are preferring to use Xblock.core functionalities and using export_to_xml method which doesn't have export_to_file funcationlity like add_xml_to_node method of XmlMixin has

@kdmccormick kdmccormick marked this pull request as draft January 21, 2025 17:54
@farhan
Copy link
Contributor Author

farhan commented Jan 22, 2025

I took a pass but since I'm not as familiar with the Xblock framework, forgive me if some of the questions have obvious answers. I'm in particular confused about why the tests need to change and if that indicates any sort of breakage that we need to handle elsewhere?

@feanil Thanks for the pass.
Let me review my implementation, rethink on them, and address your rightful queries.

Let's keep this PR in draft until I make this PR and Extracted Word Cloud PR openedx/xblocks-contrib#4 fully ready.

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 3f0447a to add935e Compare January 22, 2025 12:19

def_id = runtime.id_generator.create_definition(olx_element.tag, olx_element.get('url_name'))
keys = ScopeIds(None, olx_element.tag, def_id, runtime.id_generator.create_usage(def_id))
block = WordCloudBlock.parse_xml(olx_element, runtime, keys)
Copy link
Contributor Author

@farhan farhan Jan 24, 2025

Choose a reason for hiding this comment

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

As per discussion in pair programming session (@kdmccormick , @ttqureshi ) we are creating scope ids here which shouldn't happen and is a potential bug

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 5768e3b to d23a0a6 Compare January 28, 2025 07:38
@farhan farhan requested a review from feanil January 28, 2025 13:23
@farhan
Copy link
Contributor Author

farhan commented Jan 28, 2025

@feanil You can consider this PR to be ready for next pass

@kdmccormick kdmccormick added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Jan 30, 2025
@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 marked this pull request as ready for review February 4, 2025 09:07
@farhan farhan added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Feb 4, 2025
@farhan farhan closed this Feb 4, 2025
@farhan farhan removed the create-sandbox open-craft-grove should create a sandbox environment from this PR label Feb 5, 2025
@farhan farhan closed this Feb 5, 2025
@farhan farhan reopened this Feb 5, 2025
@farhan farhan added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Feb 5, 2025
@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 successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@farhan
Copy link
Contributor Author

farhan commented Feb 6, 2025

@kdmccormick Thanks for doing the testing

I only see half the words I added, but maybe that's existing behavior.

Yes, its existing behaviour. Often word cloud doesn't show all the words. You can refresh the page to get a refreshed experience.

But the LMS view shows nothing for me:

It was an issue. I have updated the word cloud selector in this commit and redeploy the sandbox.
So everything should work good now

Last thing looking into is #36199

cc: @ttqureshi @irtazaakram @feanil @salman2013

@salman2013
Copy link
Contributor

salman2013 commented Feb 6, 2025

On local edx-platform Studio works fine.

Screenshot 2025-02-06 at 3 34 20 PM

When i preview it then it do not show anything, Please tell me if i do anything wrong or there is something need to configure, i am wondering as the video xblock is showing in preview mode.

Screenshot 2025-02-06 at 4 06 17 PM

@farhan

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ 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

@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 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

@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
Copy link
Contributor Author

farhan commented Feb 11, 2025

@kdmccormick
I think the settings configured in the PR description has effected the sandbox but it's not reflecting the changes accordingly.

For testing, I have turned the setting USE_EXTRACTED_WORD_CLOUD_BLOCK to false as it's already hard coded to true in this PR.

But this disabling is not reflecting on the sandbox environment with multiple formats applied.

To easily test the django settings flag we have added a data variable here

I don't think so that it's something that is blocking the Word Cloud Extraction PR to be release.

cc: @openedx/axim-aximprovements , @ttqureshi

@open-craft-grove
Copy link

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

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 933fdc6 to 0cefe16 Compare February 19, 2025 09:20
@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 0cefe16 to 22ee2c8 Compare February 19, 2025 09:47
@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 closed this Feb 19, 2025
@farhan farhan reopened this Feb 19, 2025
@open-craft-grove
Copy link

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

@farhan
Copy link
Contributor Author

farhan commented Feb 19, 2025

@kdmccormick @irtazaakram @salman2013
This PR is in merge state now.
Should we merge it or close it. Sooner or later we need it when we will make the extracted word cloud as a default one.

@kdmccormick
Copy link
Member

Let's keep this unmerged. I approved the xblocks-contrib PR without testing it much myself in order to unblock development of other blocks, so I'd like to take more time to test this before we make it the default.

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

5 participants