From 9bb3d567f77eb2210c103c7d0f96fe46548bfafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Tue, 14 Jan 2025 09:12:34 +0545 Subject: [PATCH] progress: remove unused logging/tqdm lock --- src/datachain/progress.py | 13 ------------- src/datachain/query/dataset.py | 3 ++- 2 files changed, 2 insertions(+), 14 deletions(-) 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, )