diff --git a/dvc/progress.py b/dvc/progress.py index 7e85b6e18c..68c6ddd594 100644 --- a/dvc/progress.py +++ b/dvc/progress.py @@ -3,35 +3,12 @@ import logging import sys from tqdm import tqdm -from concurrent.futures import ThreadPoolExecutor from funcy import merge from dvc.utils import env2bool logger = logging.getLogger(__name__) -class TqdmThreadPoolExecutor(ThreadPoolExecutor): - """ - Ensure worker progressbars are cleared away properly. - """ - - def __enter__(self): - """ - Creates a blank initial dummy progress bar if needed so that workers - are forced to create "nested" bars. - """ - blank_bar = Tqdm(bar_format="Multi-Threaded:", leave=False) - if blank_bar.pos > 0: - # already nested - don't need a placeholder bar - blank_bar.close() - self.bar = blank_bar - return super(TqdmThreadPoolExecutor, self).__enter__() - - def __exit__(self, *a, **k): - super(TqdmThreadPoolExecutor, self).__exit__(*a, **k) - self.bar.close() - - class Tqdm(tqdm): """ maximum-compatibility tqdm-based progressbars diff --git a/dvc/remote/local.py b/dvc/remote/local.py index dff4337566..6c1d37d039 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -4,6 +4,7 @@ import errno import logging from functools import partial +from concurrent.futures import ThreadPoolExecutor from shortuuid import uuid @@ -29,7 +30,7 @@ ) from dvc.config import Config from dvc.exceptions import DvcException, DownloadError, UploadError -from dvc.progress import Tqdm, TqdmThreadPoolExecutor +from dvc.progress import Tqdm from dvc.path_info import PathInfo @@ -359,7 +360,7 @@ def _process( return 0 if jobs > 1: - with TqdmThreadPoolExecutor(max_workers=jobs) as executor: + with ThreadPoolExecutor(max_workers=jobs) as executor: fails = sum(executor.map(func, *plans)) else: fails = sum(map(func, *plans))