-
Notifications
You must be signed in to change notification settings - Fork 706
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
track progress for content download request #10830
track progress for content download request #10830
Conversation
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.
Should subclass the import manager to add the download request progress updating, rather than modifying the global JobProgressMixin.
kolibri/core/tasks/utils.py
Outdated
@@ -276,6 +277,11 @@ def update_progress(self, increment=1, message="", extra_data=None): | |||
) | |||
if extra_data and isinstance(extra_data, dict): | |||
self.job.update_metadata(**extra_data) | |||
if self.download_request: | |||
self.download_request.update_progress( |
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 is a global mixin, not just used for downloading individual pieces of metadata - this seems like the wrong place to make this change.
It would be better instead to subclass the RemoteChannelResourceImportManager
class specifically for a content request import, and add this logic there, invoking the super
method for update_progress
and then also applying this change.
kolibri/core/tasks/utils.py
Outdated
@@ -289,6 +295,8 @@ def start_progress(self, total=100): | |||
self.progresstracker = ProgressTracker(total=total) | |||
if self.job: | |||
self.job.update_progress(0, total) | |||
if self.download_request: |
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.
Likewise here.
@@ -480,6 +480,7 @@ def process_download_request(download_request): | |||
baseurl=peer.base_url, | |||
node_ids=[download_request.contentnode_id], | |||
) | |||
import_manager.download_request = download_request |
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.
In the subclassed import manager, we should pass in the download request in the __init__
function, rather than setting it externally.
@@ -466,6 +466,20 @@ def build_for_user(cls, user): | |||
status=ContentRequestStatus.Pending, | |||
) | |||
|
|||
def update_progress(self, progress, total_progress): |
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 seems like the correct place for this logic to live.
Hi @Jaspreet-singh-1032 - thanks for the hard work here, I think this is mostly done, just need to shuffle around where this logic is being added. |
Sure @rtibbles, I will make these changes. |
Hello @rtibbles, can we re-run the workflows? I think some of the checks canceled because of taking too long time. |
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.
Beautiful - so clean!
References
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)