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

feat: Added XblockMixin for skill tagging #34130

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

irfanuddinahmad
Copy link
Contributor

Description

This PR adds a Xblock Mixin for verifying the skill tags associated with Xblocks. The Mixin class resides here.

Other information

The setting was previously reverted due to high number of LMS -> Discovery service calls. A probabilistic throttle has been added to reduce the calls frequency. A django Waffle switch has been added to quickly respond to any anomalous events.

lms/envs/common.py Show resolved Hide resolved
@irfanuddinahmad irfanuddinahmad merged commit 2fb3eaa into master Jan 30, 2024
64 checks passed
@irfanuddinahmad irfanuddinahmad deleted the iahmad/ENT-8117 branch January 30, 2024 09:18
@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.

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

@kdmccormick
Copy link
Member

Hey @irfanuddinahmad @saleem-latif , we'll need to revert this PR on April 29th (before the Redwood cut) because it adds non-core package reference to the core settings file: #34530 .

To ensure that the revert has no impact on your prod environment, you can apply this same change to your private LMS settings file.

@muhammad-ammar
Copy link
Contributor

@kdmccormick Can you please elaborate what do you mean by private LMS settings file. As per my knowledge, there is nothing like private LMS settings file. for production.

@kdmccormick
Copy link
Member

kdmccormick commented Apr 18, 2024

@muhammad-ammar By "private settings file" I mean a 2U-internal django settings module, which your production envs would point at by setting DJANGO_SETTINGS_MODULE.

If the value of that is just lms.envs.production, that'd mean that 2U does not have a private settings file, which would make this a bit harder than I'd thought.

@kdmccormick
Copy link
Member

@muhammad-ammar Sorry, I was confused, you don't need a private settings module to fix this!

This can be done right in your internal lms.yml:

XBLOCK_EXTRA_MIXINS:
- skill_tagging.skill_tagging_mixin.SkillTaggingMixin

When your YAML is loaded into lms/envs/production.py, it will override the XBLOCK_EXTRA_MIXINS setting, which will get appended to XBLOCK_MIXINS: https://github.com/openedx/edx-platform/blob/master/lms/envs/production.py#L1094

@irfanuddinahmad
Copy link
Contributor Author

@muhammad-ammar Sorry, I was confused, you don't need a private settings module to fix this!

This can be done right in your internal lms.yml:

XBLOCK_EXTRA_MIXINS:
- skill_tagging.skill_tagging_mixin.SkillTaggingMixin

When your YAML is loaded into lms/envs/production.py, it will override the XBLOCK_EXTRA_MIXINS setting, which will get appended to XBLOCK_MIXINS: https://github.com/openedx/edx-platform/blob/master/lms/envs/production.py#L1094

@kdmccormick The above solution causes a import error for skill_tagging

ImportError: Couldn't import class 'skill_tagging.skill_tagging_mixin.SkillTaggingMixin': ImportError: cannot import name 'NamedAttributesMetaclass' from 'xblock.internal' (/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/xblock/internal.py)

@kdmccormick
Copy link
Member

@irfanuddinahmad , that's because NamedAttributesMixin was deprecated and removed in XBlock 3.0. The same ImportError must be happing in 2U production right now, but silenced due to the try: ... except ImportError: ... clause in common.py, which means that SkillTagging has probably been disabled in edx-platform since the XBlock 3 upgrade merged last week. To fix SkillTagging, update the SkillTaggingMixin class to inherit from xblock.core.XBlockMixin instead of xblock.internal.NamedAttributesMixin.

@irfanuddinahmad
Copy link
Contributor Author

irfanuddinahmad commented Apr 27, 2024

@irfanuddinahmad , that's because NamedAttributesMixin was deprecated and removed in XBlock 3.0. The same ImportError must be happing in 2U production right now, but silenced due to the try: ... except ImportError: ... clause in common.py, which means that SkillTagging has probably been disabled in edx-platform since the XBlock 3 upgrade merged last week. To fix SkillTagging, update the SkillTaggingMixin class to inherit from xblock.core.XBlockMixin instead of xblock.internal.NamedAttributesMixin.

@kdmccormick the new version of skill tagging is working fine with the current XBLOCK_MIXINS in common.py
However, when we also add SkillTaggingMixin in the XBLOCK_EXTRA_MIXINS ... we start getting the TypeError: duplicate base class SkillTaggingMixin error
We have now decided to disable the filter that uses this mixin and let your updates to common.py to merge and swim through to 2U. We can then re-enable this filter and also add the XBLOCK_EXTRA_MIXINS remote config. We will disable the filter before 8am EST on the 04/29

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.

5 participants