From c02807deb3fb691ea951a6a78d1d4db62d522742 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 28 Jul 2019 16:01:18 +0100 Subject: [PATCH] tqdm remote.oss --- dvc/remote/oss.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dvc/remote/oss.py b/dvc/remote/oss.py index 79912edc3..6e493cc07 100644 --- a/dvc/remote/oss.py +++ b/dvc/remote/oss.py @@ -13,7 +13,7 @@ except ImportError: from dvc.config import Config from dvc.remote.base import RemoteBASE -from dvc.remote.azure import Callback +from dvc.progress import Tqdm from dvc.path_info import CloudURLInfo @@ -107,15 +107,15 @@ class RemoteOSS(RemoteBASE): def _upload( self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs ): - cb = None if no_progress_bar else Callback(name) - self.oss_service.put_object_from_file( - to_info.path, from_file, progress_callback=cb - ) + with Tqdm(desc_truncate=name, disable=no_progress_bar) as pbar: + self.oss_service.put_object_from_file( + to_info.path, from_file, progress_callback=pbar.update_to + ) def _download( self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs ): - cb = None if no_progress_bar else Callback(name) - self.oss_service.get_object_to_file( - from_info.path, to_file, progress_callback=cb - ) + with Tqdm(desc_truncate=name, disable=no_progress_bar) as pbar: + self.oss_service.get_object_to_file( + from_info.path, to_file, progress_callback=pbar.update_to + )