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!: use replace_urls service instead of runtime property [BD-13] #318

Merged

Conversation

Agrendalath
Copy link
Member

@Agrendalath Agrendalath commented Mar 26, 2023

Description

BREAKING CHANGE: This breaks Maple compatibility.

Using the property of runtime is deprecated. It also breaks Block Structures when the ModuleSystem is unified with DescriptorSystem.

Supporting information

Related PR: openedx/edx-platform#31472

Testing instructions (optional)

  1. Create a course with two DnDv2 XBlocks and complete the first one.
  2. Replace the block_id and run the following snippet:
from lms.djangoapps.course_blocks.api import get_course_blocks
from opaque_keys.edx.locator import BlockUsageLocator

u = User.objects.get(username='edx')
key = BlockUsageLocator.from_string('block_id')
block_data = get_course_blocks(u, key)
  1. Visit the /dashboard. This will trigger the code to find the resume URL and attempt to re-generate Block Structures.

Deadline

Before openedx/edx-platform#31472.

Author's notes

A quick summary: the Block Structures are used for caching the structure of the Course Outline page (stored as files in S3). The caching operation has a limited runtime for XBlocks (it does not include all available runtime services). However, when the completion tracking is enabled, this still needs to generate student-specific data for the most recently completed XBlock to perform some calculations. There is a lot of redundancy and a massive room for optimizations, but there are enough layers to make a whole new epic of out debugging it.

Generating student data of DnDv2 replaces static links, but the relevant service is unavailable. Therefore, we ignore this step - it does not affect the result. As for why this is happening after merging the ModuleSystem and DescriptorSystem - previously, the caching operation was relying directly on the DescriptorSystem, which didn't have the replace_urls attribute. We still need to keep it in the ModuleSystem for backward compatibility. As the ModuleSystem and DescriptorSystem become the same class in the mentioned PR, it will now have the replace_urls attribute, which makes the logic in DnDv2 invalid.

We could do a few different things - e.g., move the replacing static links operation to another part of the DnDv2 (or make it lazy), but this would break tons of tests, making it a more significant change. Given the limited time and budget here, this seemed like the most straightforward fix to me.

@Agrendalath Agrendalath self-assigned this Mar 26, 2023
@openedx-webhooks openedx-webhooks added the blended PR is managed through 2U's blended developmnt program label Mar 26, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 26, 2023

Thanks for the pull request, @Agrendalath!

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks
Copy link

Thanks for the pull request, @Agrendalath!

This is currently a draft pull request. When it is ready for our review and all tests are green, click "Ready for Review", or remove "WIP" from the title, as appropriate.

@Agrendalath Agrendalath force-pushed the agrendalath/bd-13-fix_services branch 2 times, most recently from 21dd713 to 806cf43 Compare April 20, 2023 14:42
@Agrendalath Agrendalath marked this pull request as ready for review April 20, 2023 14:42
@Agrendalath Agrendalath changed the title feat: use replace_urls service instead of runtime property [BD-13] feat!: use replace_urls service instead of runtime property [BD-13] Apr 20, 2023
@@ -1,4 +1,4 @@
""" Drag and Drop v2 XBlock """
from .drag_and_drop_v2 import DragAndDropBlock

__version__ = "3.1.3"
__version__ = "3.2.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

Maple is an old release, so I didn't bother bumping the major version number. Let me know if we should do this, though.

@Cup0fCoffee
Copy link

@Agrendalath Since we are breaking the compatibility with Maple, and self.runtime.replace_urls is being deprecated, do you think we can remove this section as well?

@Cup0fCoffee
Copy link

👍 Other than this comment, everything else looks fine.

  • I tested this: ran the testing steps
  • I read through the code

BREAKING CHANGE: This breaks Maple compatibility.
@Agrendalath Agrendalath force-pushed the agrendalath/bd-13-fix_services branch from 806cf43 to 62ab205 Compare April 21, 2023 08:52
@Agrendalath Agrendalath merged commit 0b0bb0c into openedx:master Apr 21, 2023
@openedx-webhooks
Copy link

@Agrendalath 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@Agrendalath Agrendalath deleted the agrendalath/bd-13-fix_services branch April 21, 2023 09:14
@openedx-webhooks
Copy link

@Agrendalath 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blended PR is managed through 2U's blended developmnt program
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants