-
Notifications
You must be signed in to change notification settings - Fork 17
feat: include learning package metadata in the backup dump file #402
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
Conversation
|
Thanks for the pull request, @dwong2708! 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. |
| learning_package: LearningPackage, | ||
| timestamp: datetime, | ||
| format_version: int = 1, | ||
| user: str | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take an actual User object, so that we can add more info about the user later if we decide it's prudent, e.g. their email.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Changes have been applied.
| # Learning package metadata | ||
| metadata = tomlkit.table() | ||
| metadata.add("format_version", format_version) | ||
| metadata.add("created_by", user or "unknown") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't have user information, let's just omit the field. The string "unknown" is a highly unlikely, but technically legal username. Omitting the field is more or less the TOML version of making null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Done. Thanks.
| metadata.add("format_version", format_version) | ||
| metadata.add("created_by", user or "unknown") | ||
| metadata.add("created_at", timestamp) | ||
| metadata.add("origin_server", getattr(settings, "CMS_BASE", "unknown")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh. I forgot that we'd need to pipe this value from edx-platform settings if we were to include it. We don't want to start the precedent of openedx-learning knowing about edx-platform specific settings. Let's just make this an optional param on the function for now, instead of reading from the settings. Libraries code in edx-platform can pass it in later. This is another one of those fields that we can omit if there's no value passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. The value needs to be provided from edx-platform. Changes applied.
ormsbee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit, but otherwise LGTM
| format_version = 1 | ||
| created_by = "dormsbee" | ||
| created_at = 2025-09-03T17:50:59.536190Z | ||
| origin_server = "http://cms.test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| origin_server = "http://cms.test" | |
| origin_server = "cms.test" |
Nit: The value from CMS_BASE isn't going to include "http://".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks.
Resolves: #395
Changes
Add metadata to the backup dump file with the following fields: