From d2b0dd5ed83b69a50f6fd924a4cb92577310d81e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 5 Apr 2020 13:43:25 +0100 Subject: [PATCH 1/3] progress: add main push/pull bar Fixes #3452 Related #1840 Related #3565 --- dvc/remote/local.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index fe0270ef34..7da35343fe 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -341,9 +341,11 @@ def _process( file_mode=self._file_mode, ) status = STATUS_DELETED + desc = "Pulling" else: func = remote.upload status = STATUS_NEW + desc = "Pushing" if jobs is None: jobs = remote.JOBS @@ -361,11 +363,13 @@ def _process( if len(plans[0]) == 0: return 0 - if jobs > 1: - with ThreadPoolExecutor(max_workers=jobs) as executor: - fails = sum(executor.map(func, *plans)) - else: - fails = sum(map(func, *plans)) + with Tqdm(total=len(plans[0]), unit="file", desc=desc) as pbar: + func = pbar.wrap_fn(func) + if jobs > 1: + with ThreadPoolExecutor(max_workers=jobs) as executor: + fails = sum(executor.map(func, *plans)) + else: + fails = sum(map(func, *plans)) if fails: if download: From 68eba2c085ad6d03528e73636d5eb99b2b2a7297 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sat, 25 Apr 2020 20:57:21 +0300 Subject: [PATCH 2/3] adjust desc --- dvc/remote/local.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 7da35343fe..4c3271bb6d 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -341,11 +341,11 @@ def _process( file_mode=self._file_mode, ) status = STATUS_DELETED - desc = "Pulling" + desc = "Downloading" else: func = remote.upload status = STATUS_NEW - desc = "Pushing" + desc = "Uploading" if jobs is None: jobs = remote.JOBS From b1aba485547fa361a5c5123a27b4566cf842a3a9 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sat, 25 Apr 2020 21:32:14 +0300 Subject: [PATCH 3/3] fix merge --- dvc/remote/local.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 5b4ee7110b..6045cf25f3 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -468,10 +468,11 @@ def _process( dir_plans = self._get_plans(download, remote, dir_status, status) file_plans = self._get_plans(download, remote, file_status, status) - if len(dir_plans[0]) + len(file_plans[0]) == 0: + total = len(dir_plans[0]) + len(file_plans[0]) + if total == 0: return 0 - with Tqdm(total=len(plans[0]), unit="file", desc=desc) as pbar: + with Tqdm(total=total, unit="file", desc=desc) as pbar: func = pbar.wrap_fn(func) with ThreadPoolExecutor(max_workers=jobs) as executor: if download: