Skip to content

backpopulate files by resource id #2174

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

Merged
merged 1 commit into from
Apr 11, 2025
Merged

Conversation

abeglova
Copy link
Contributor

@abeglova abeglova commented Apr 2, 2025

What are the relevant tickets?

closes https://github.com/mitodl/hq/issues/7021

Description (What does it do?)

This pr updates the backpopulate files management commands for edx platforms to accept learning_resource_id to make it possible to update content files for a single learning resource

How can this be tested?

Go to http://api.open.odl.local:8063/api/v1/learning_resources/ and find an course on one of the edx platforms

Go to
http://api.open.odl.local:8063/api/v1/contentfiles/?resource_id= to check if the learning resource has content files

if you find some content files you can run

from learning_resources.models import *
ContentFile.objects.filter(run__learning_resource_id=<resource id>).update(content='i like dogs')

run

docker-compose run -u root --rm web ./manage.py <appropriate edx platform backpopulate job> --overwrite --resource_id = <resource id>

The job should finish relatively quickly
Go back to
http://api.open.odl.local:8063/api/v1/contentfiles/?resource_id= and verify that the content files exist and have the correct content

Run a file backpopulate command without the learning_resource flag and verify that it works normally. You can kill the job prematurely since it can take a while if you haven't already backpopulated the content files for that platform or if you use the --overwrite flag

@abeglova abeglova marked this pull request as ready for review April 2, 2025 16:18
@abeglova abeglova added the Needs Review An open Pull Request that is ready for review label Apr 2, 2025
@shanbady shanbady self-assigned this Apr 3, 2025
Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

Not sure exactly whats happening buy when i try running python manage.py backpopulate_mitxonline_files --overwrite --learning_resource_id 8077 it does not appear to be updating the content after I changed it. i also tried deleting the contentfile object altogether to see if it would come back but it didnt. the celery task did seem to only process one item though just looking at the runtime

@@ -28,11 +28,20 @@ def add_arguments(self, parser):
help="Overwrite any existing records",
)

parser.add_argument(
"--learning_resource_id",
dest="learning_resource_id",
Copy link
Contributor

Choose a reason for hiding this comment

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

it might be good to have this parameter accept a list of comma separated ids like we do with embeddings and summary generation commands. something like --resource-ids 1,234,422

Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide 18 changes: 12 error, 0 warning, 6 info
18 changes: 12 error, 0 warning, 6 info
error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		removed the required property '/items/is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		removed the required property 'is_authenticated' from the response with the '201' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		the response property '/items/profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the response property 'profile' became required for the status '201'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'


2 similar comments
Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide 18 changes: 12 error, 0 warning, 6 info
18 changes: 12 error, 0 warning, 6 info
error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		removed the required property '/items/is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		removed the required property 'is_authenticated' from the response with the '201' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		the response property '/items/profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the response property 'profile' became required for the status '201'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'


Copy link

github-actions bot commented Apr 9, 2025

OpenAPI Changes

Show/hide 18 changes: 12 error, 0 warning, 6 info
18 changes: 12 error, 0 warning, 6 info
error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		removed the required property '/items/is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		removed the required property 'is_authenticated' from the response with the '201' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[request-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the request property 'profile' became required

error	[response-required-property-removed] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		removed the required property 'is_authenticated' from the response with the '200' status

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/
		the response property '/items/profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/users/
		the response property 'profile' became required for the status '201'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/me/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PATCH /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'

info	[response-property-became-required] at head/openapi/specs/v0.yaml	
	in API PUT /api/v0/users/{username}/
		the response property 'profile' became required for the status '200'


@abeglova abeglova force-pushed the ab/backpopulate-files-by-run branch from 150134e to 76b063f Compare April 10, 2025 13:20
Copy link

OpenAPI Changes

Show/hide No detectable change.

Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

👍

@abeglova abeglova force-pushed the ab/backpopulate-files-by-run branch from 76b063f to 3a52ed8 Compare April 11, 2025 16:01
Copy link

OpenAPI Changes

Show/hide No detectable change.

@abeglova abeglova merged commit 70b73c4 into main Apr 11, 2025
12 checks passed
@abeglova abeglova deleted the ab/backpopulate-files-by-run branch April 11, 2025 16:16
This was referenced May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review Waiting on author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants