Skip to content
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

Content download request progress tracking #10391

Closed
bjester opened this issue Apr 5, 2023 · 17 comments · Fixed by #10830
Closed

Content download request progress tracking #10391

bjester opened this issue Apr 5, 2023 · 17 comments · Fixed by #10830
Assignees
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend P0 - critical Priority: Release blocker or regression TAG: new feature New user-facing feature

Comments

@bjester
Copy link
Member

bjester commented Apr 5, 2023

Depends on: #10365

Summary

With #10365, we implemented the automatic import of content assigned in lessons and exams. The automatic import also processes user-initiated downloads in addition to sync-initiated downloads. For user-initiated downloads, the user can see the state the current state of the download request. It would be helpful to surface the actual progress percentage of the download request, because users with low-bandwidth connections, or downloads of large files, could take a while.

Deliverables

The mixin class JobProgressMixin

  • It should be refactored such that the mixin, and its existing usage with the resource import classes, can be used to track progress elsewhere than a job

The function process_download_request

  • It should leverage the above updates to the JobProgressMixin, inherited by RemoteChannelResourceImportManager, to attach a method that will update the ContentDownloadRequest with the progress of the download
  • The progress should either be tracked in a new ContentRequest field or the metadata field

The component MyDownloads

  • It should be updated to render a determinate loader with the percentage progress of the download

References

https://learningequality.slack.com/archives/CB37UM23A/p1679665808045409

Setting up manual testing scenario

Be sure to use separate Kolibri home directories for each instance by using the environment variable KOLIBRI_HOME

For Instance A

  1. Provision a new full-facility Kolibri instance through the setup wizard: Group learning > Full device > Create new learning facility. Note
  2. Complete the setup
  3. Navigate to Device > Channels
  4. Import some content, which will be used for creating a lesson
  5. Navigate to Facility > Users
  6. Add a new Learner, remember their password
  7. Navigate to Coach > Plan
  8. Create a new Lesson and assign it to the Learner
  9. Add some resources to the lesson
  10. Ensure the lesson is visible to the learner / assignees

For Instance B

  1. Provision a new learn-only Kolibri instance, running on a different port than Instance A: Group learning > Learn-only device > Create new learning facility > Import one or more existing user accounts from an existing facility
  2. Select Instance A from the 'Select network address' modal
  3. Input the Learner credentials you created on Instance A
  4. Complete the setup
  5. The initial import of the learner should trigger the automatic content import of assigned materials in the lesson

Further testing

To continue testing the automatic content import you may:

  • Continue creating new lessons or quizzes, or marking them as invisible for the learners for removal testing, in Instance A and let them auto sync to Instance B while they're both running, or
  • Delete the Kolibri home for Instance B and reprovision it allowing the initial import to be tested
@bjester bjester added TAG: new feature New user-facing feature P0 - critical Priority: Release blocker or regression DEV: backend Python, databases, networking, filesystem... DEV: frontend labels Apr 5, 2023
@bjester bjester added the APP: Learn Re: Learn App (content, quizzes, lessons, etc.) label Apr 5, 2023
@Jaspreet-singh-1032
Copy link
Contributor

Hi @bjester, can I help with this task?

@bjester
Copy link
Member Author

bjester commented Apr 17, 2023

@Jaspreet-singh-1032 Yes, I followed up in our slack channel. You may skip the updates to the component MyDownloads, since that frontend component likely won't be updated yet to actually receive this information from the backend

@Jaspreet-singh-1032
Copy link
Contributor

Hello @bjester, can you please tell me how can I trigger and test this process?

@bjester
Copy link
Member Author

bjester commented Apr 21, 2023

@Jaspreet-singh-1032 I added some manually testing instructions to the issue

@Jaspreet-singh-1032
Copy link
Contributor

Thanks!

@Jaspreet-singh-1032
Copy link
Contributor

Hi @bjester, I could not get time to work on it last week. But now I have resumed work on this one. I have set up two instances of Kolibri locally for admin and learner. And will let you know about the further implementation.

@bjester
Copy link
Member Author

bjester commented May 22, 2023

Hi @Jaspreet-singh-1032, could you share a progress update?

@Jaspreet-singh-1032
Copy link
Contributor

Yes @bjester, can we pass the download_request from here like this

image

And assign download_request to the object instance and then reuse the current methods of JobProgressMixin just by adding
a condition to check if the object has the attribute download_request and then update its progress.
Something like this

image

Let me know what do you think about this.

@bjester
Copy link
Member Author

bjester commented May 22, 2023

@Jaspreet-singh-1032 Yes that should work fine. Since this is a very specific use case, I think it's generally wise to think about how this could be integrated without directly coupling the two, but the changes are few so we could revisit it another time.

It could make sense to add a @classmethod that acts as a factory and builds the RemoteChannelResourceImportManager instance from the ContentDownloadRequest, similar to .from_manifest

@Jaspreet-singh-1032
Copy link
Contributor

Thanks. Sure, I will add a classmethod in ContentDownloadRequest to build RemoteChannelResourceImportManager and I think I will also have to add two new fields in ContentDownloadRequest model for saving the progress and the total_progress.

@bjester
Copy link
Member Author

bjester commented May 23, 2023

What is total_progress used for? Since a download request maps to a content node, I would think total_progress would be simply 100%

@Jaspreet-singh-1032
Copy link
Contributor

I thought of adding it because this is how currently JobProgressMixin is tracking progress. What I think is total_progress is the number of files and progress is currently processed data and the percentage can be calculated using both of them. Let me know if it is not like this.

@bjester
Copy link
Member Author

bjester commented May 23, 2023

I think having a new total_progress field stored in the database is unnecessary

@Jaspreet-singh-1032
Copy link
Contributor

Let me see if we can make it work only with one progress field.

@bjester
Copy link
Member Author

bjester commented Jun 6, 2023

@Jaspreet-singh-1032 When do you expect a PR to be opened?

@Jaspreet-singh-1032
Copy link
Contributor

Actually, I was currently working on it. I know it gets late but I will be opening a PR in the upcoming days maybe before this weekend.

@bjester
Copy link
Member Author

bjester commented Jun 6, 2023

Thank you @Jaspreet-singh-1032

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend P0 - critical Priority: Release blocker or regression TAG: new feature New user-facing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants