-
Notifications
You must be signed in to change notification settings - Fork 745
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
Add --manifest-only option to exportcontent command #12059
Add --manifest-only option to exportcontent command #12059
Conversation
I need to add tests here |
logger.info( | ||
"Exporting content for channel id {} to {}".format(channel_id, data_dir) | ||
) | ||
exported_files = [] |
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.
How about moving this copying part to a separate method? It will be more readable
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.
Yes, that seems fine to me.
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.
Alright will do that!
Build Artifacts
|
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 looks like the right change so far! Agree with the small refactor, and this will be good to go with a couple of tests.
See this class for existing tests for this management command, additional tests can be added there! https://github.com/learningequality/kolibri/blob/develop/kolibri/core/content/test/test_import_export.py#L2176
logger.info( | ||
"Exporting content for channel id {} to {}".format(channel_id, data_dir) | ||
) | ||
exported_files = [] |
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.
Yes, that seems fine to me.
I have included with tests as well |
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.
Looks good to me, one optional piece of cleanup.
logger.info( | ||
"Exporting content for channel id {} to {}".format(channel_id, data_dir) | ||
) | ||
exported_files = [] |
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 know you copy pasted this from the original implementation - but it seems like this exported_files value is not actually used? Feels like we could remove it and stop collecting the list if it's unused. At a minimum, it will slightly reduce memory usage.
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!!
"exportcontent", self.the_channel_id, tempfile.mkdtemp(), manifest_only=True | ||
) | ||
|
||
copy_content_files_mock.assert_not_called() |
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.
Your refactor definitely makes asserting the behaviour here much simpler too!
Excellent work, thanks @thesujai! |
Summary
Adds a new
--manifest-only
option to just export the manifest.json file instead of entire content data in theexportcontent
commandReferences
Fixes #10384
Reviewer guidance
Run the below command:
Observe only manifest.json getting generated, contrary to above command being used without
--manifest-only
which will also generate contentTesting checklist
PR process
Reviewer checklist
yarn
andpip
)