diff --git a/src/datachain/progress.py b/src/datachain/progress.py index cf681fa43..9ed924100 100644 --- a/src/datachain/progress.py +++ b/src/datachain/progress.py @@ -1,14 +1,5 @@ -"""Manages progress bars.""" - -import logging -from threading import RLock - from fsspec import Callback from fsspec.callbacks import TqdmCallback -from tqdm.auto import tqdm - -logger = logging.getLogger(__name__) -tqdm.set_lock(RLock()) class CombinedDownloadCallback(Callback): @@ -24,10 +15,6 @@ def increment_file_count(self, n: int = 1) -> None: class TqdmCombinedDownloadCallback(CombinedDownloadCallback, TqdmCallback): def __init__(self, tqdm_kwargs=None, *args, **kwargs): self.files_count = 0 - tqdm_kwargs = tqdm_kwargs or {} - tqdm_kwargs.setdefault("postfix", {}).setdefault("files", self.files_count) - kwargs = kwargs or {} - kwargs["tqdm_cls"] = tqdm super().__init__(tqdm_kwargs, *args, **kwargs) def increment_file_count(self, n: int = 1) -> None: diff --git a/src/datachain/query/dataset.py b/src/datachain/query/dataset.py index d1cd22cf5..b510b604d 100644 --- a/src/datachain/query/dataset.py +++ b/src/datachain/query/dataset.py @@ -355,7 +355,7 @@ def process_udf_outputs( def get_download_callback(suffix: str = "", **kwargs) -> CombinedDownloadCallback: return TqdmCombinedDownloadCallback( - { + tqdm_kwargs={ "desc": "Download" + suffix, "unit": "B", "unit_scale": True, @@ -363,6 +363,7 @@ def get_download_callback(suffix: str = "", **kwargs) -> CombinedDownloadCallbac "leave": False, **kwargs, }, + tqdm_cls=tqdm, )