-
Notifications
You must be signed in to change notification settings - Fork 3
Prevent test courses from being overwritten #2262
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
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.
Works great, just mentioned 1 concern but it might be an irrelevant edge case.
learning_resources/etl/loaders.py
Outdated
run_id=run_id, learning_resource=learning_resource | ||
).learning_resource.test_mode | ||
): | ||
return 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.
Not sure if it matters, but I suspect that if a "test_mode" course has additional runs added to it later on the edx side, they won't be added here because of these additional lines.
learning_resources/etl/loaders.py
Outdated
|
||
if learning_resource_run.learning_resource.test_mode: | ||
learning_resource_run.published = True | ||
learning_resource_run.save() |
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 think this could be moved to before the transaction.atomic
block so that the change is saved within that block:
if learning_resource.test_mode:
run_data["published"] = True
with transaction.atomic():
...etc
Also...should all test_mode course runs be automatically set to published=True
? Maybe there's a legitimate reason for 1 or more of the runs to not be published?
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.
moved it to before the atomic block. I'm not aware of any consequences of setting them all to published if the course is in test mode and the resource is unpublished. I figure we can patch that when/if the need arises.
…ormatted test logic
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.
👍
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/7373
Description (What does it do?)
We have a mechanism for tagging certain courses as being in "test_mode" so that they have their contentfiles ingested into qdrant and opensearch but remain "unpublished". There is an issue where scheduled etl backpopulate tasks overwrite this status and remove contentfiles from the indexes.
How can this be tested?
python manage.py backpopulate_mitxonline_data
and re-run
backpopulate_mitxonline_files --resource-ids <resource_id> --test-ids <resource_id> --overwrite
python manage.py backpopulate_mitxonline_data
-> note that the contentfiles for that particular run are gone/removed.Checklist: