-
Notifications
You must be signed in to change notification settings - Fork 303
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
Extract subtitles and assessment items into the right directories #4827
Extract subtitles and assessment items into the right directories #4827
Conversation
assessment_zip_dir = "assessment_resources/" | ||
|
||
try: | ||
channel = zf.read("channel.name") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
d24118c
to
b55925d
Compare
Instead of unpack_assessment_zip.
Move away from tastypie endpoint, since our needs are simple and few.
b55925d
to
fde7af9
Compare
@@ -61,8 +61,7 @@ def update_content_availability(content_list, language="en", channel="khan"): | |||
|
|||
# Databases have been pre-filtered to only contain existing exercises | |||
# Assume if the assessment items have been downloaded, then everything is hunky dory. | |||
if os.path.exists(contentload_settings.KHAN_ASSESSMENT_ITEM_VERSION_PATH): | |||
update["available"] = True | |||
update["available"] = True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
As mentioned by @benjaoming, there will be a significant probability of delay if we go full hog with
TODO:
|
@MCGallaspy @cpauya ^ take note. |
d414010
to
f493ea7
Compare
|
f493ea7
to
7347aef
Compare
Super, @aronasorman, thanks for taking quick action on this! :) |
Thanks for the mention @aronasorman. |
@aronasorman may I take it from here or do you have further work you're planning to push? |
@benjaoming tests are failing, but feel free to take it from here. Further changes I need to do are on the content-pack-maker side now. |
awesome, thanks for the response! |
@benjaoming reopened this, with merge conflicts and test failures fixed. |
@@ -5,7 +5,7 @@ | |||
- Run migrations | |||
- Find and relocate obsolete user and data files | |||
- if interactive: | |||
- Download and unpack assessment items | |||
- Download and english content pack, containing assessment items |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
else: | ||
call_command("unpack_assessment_zip", ass_item_filename) | ||
call_command("retrievecontentpack", retrieval_method, "en", ass_item_filename) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Since we now skip over exercise availability annotation (they've been premarked in the content-pack-maker side), `update_content_availability` will now never return any exercises. So these tests will always fail unless we change the way we test `update_content_availability`.
Tests now pass, but I had to delete the previous failing tests, since they didn't capture the right behaviour anymore. I'd rather put off restoring the tests into another PR, so that the commits in here can be merged. |
If the behavior of annotate_content_availability has changed so drastically as to be useless, then perhaps we should remove that function (and the associated test module) entirely? Practically, the likelihood of us writing a test drops way down if we don't do it now, and the result will be that we have both dead tests and untested code. |
It's not that it's now useless, the test just wasn't up to spec. Here's what happened:
Now, the proper solution is to refactor the test to use videos instead of exercises. However, that will take 1-2 more days just writing the test. I think the contents of the PR are critical enough such that we should merge it soon without waiting for 2 more days, since proper KA Lite behaviour depends on the fixes here. |
assessment_item = get_assessment_item_data(channel=getattr(request, "channel", "khan"), | ||
language=getattr(request, "language", "en"), | ||
assessment_item_id=assessment_item) | ||
return JsonResponse(assessment_item) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ProfileTop 20 items from profiling, sorted by total time:
Top 20 items sorted by cumulative time:
ConclusionThe built-in |
@rtibbles I'll defer to you to merge this -- there are no obvious errors to me, though I am concerned about the above items. However, after discussing with @aronasorman I think it's important to merge this and tackle any related issues separately, so that testing KA Lite can proceed. |
Some open questions here - I think we may want to revisit the current client side behaviour if nothing is returned from the assessment items, for example. But let's merge this so KA Lite testing can continue. |
…sment-items Extract subtitles and assessment items into the right directories
Thanks for benchmarking! I can make this faster by assuming certain things in the path. That would make it brittle (it would mean the path we extract to and the path of assessment items in the zip file wouldn't change), but it would mean we can just call Made an issue: #4827 (comment) |
If the performance increase is very substantial, I would prefer that. |
WIP, but once merged, this fully deprecates
languagepackdownload
andunpack_assessment_zip
.TODO:
setup
command to useretrievecontentpack
instead ofunpack_assessment_zip
retrievecontentpack
in the language pack UI[ ] delete(languagepackdownload
andunpack_assessment_zip
unpack_assessment_zip
removal will happen for 0.17.)Changes:
retrievecontentpack
to extract subtitles and assessment items.retrievecontentpack
.languagepackdownload
command. Purged associated tests as well.Bug:
call_command_async
rather thanforce_job
for launchingretrievecontentpack
, the progress bar doesn't appear anymore.Note to reviewers: It's easier to review this commit by commit.