Skip to content

Commit

Permalink
Pass consistent task progress during syncing.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Aug 22, 2023
1 parent 761ebf6 commit 95ba857
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions kolibri/core/auth/management/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import getpass
import json
import logging
import math
import sys
from contextlib import contextmanager
from functools import wraps
Expand Down Expand Up @@ -659,23 +658,19 @@ def stats(transfer_session):

def started(transfer_session):
stats(transfer_session)
self.start_progress(total=100)
self.start_progress(total=transfer_session.records_total or 100)

def handler(transfer_session):
"""
:type transfer_session: morango.models.core.TransferSession
"""
if transfer_session.records_total > 0:
progress = (
100
* transfer_session.records_transferred
/ float(transfer_session.records_total)
)
progress = transfer_session.records_transferred
else:
progress = 100

self.update_progress(
increment=math.ceil(progress - self.progresstracker.progress),
current_progress=progress,
message=stats_msg(transfer_session),
extra_data=dict(
bytes_sent=transfer_session.bytes_sent,
Expand Down Expand Up @@ -703,7 +698,7 @@ def _queueing_tracker_adapter(
"""

def started(transfer_session):
self.start_progress(total=2)
self.start_progress(total=1)
dataset_cache.clear()
if noninteractive or self.progresstracker.progressbar is None:
if (
Expand Down

0 comments on commit 95ba857

Please sign in to comment.