fetch: show progress when collecting

This commit is contained in:
Ruslan Kuprieiev
2023-06-10 22:48:16 +03:00
parent 3dca69b678
commit fc8ec6aa95
2 changed files with 11 additions and 4 deletions
+10 -3
View File
@@ -33,6 +33,7 @@ def fetch( # noqa: C901, PLR0913
config.NoRemoteError: thrown when downloading only local files and no config.NoRemoteError: thrown when downloading only local files and no
remote is configured remote is configured
""" """
from dvc.fs.callbacks import Callback
from dvc_data.index.fetch import fetch as ifetch from dvc_data.index.fetch import fetch as ifetch
if isinstance(targets, str): if isinstance(targets, str):
@@ -65,9 +66,15 @@ def fetch( # noqa: C901, PLR0913
if remote: if remote:
self.config["core"]["remote"] = remote self.config["core"]["remote"] = remote
fetch_transferred, fetch_failed = ifetch( with Callback.as_tqdm_callback(
_indexes(), jobs=jobs desc="Fetching",
) # pylint: disable=assignment-from-no-return unit="file",
) as cb:
fetch_transferred, fetch_failed = ifetch(
_indexes(),
jobs=jobs,
callback=cb,
) # pylint: disable=assignment-from-no-return
finally: finally:
if remote: if remote:
self.config["core"]["remote"] = saved_remote self.config["core"]["remote"] = saved_remote
+1 -1
View File
@@ -34,7 +34,7 @@ dependencies = [
"configobj>=5.0.6", "configobj>=5.0.6",
"distro>=1.3", "distro>=1.3",
"dpath<3,>=2.1.0", "dpath<3,>=2.1.0",
"dvc-data>=1.2.0,<1.3.0", "dvc-data>=1.2.1,<1.3.0",
"dvc-http>=2.29.0", "dvc-http>=2.29.0",
"dvc-render>=0.3.1,<1", "dvc-render>=0.3.1,<1",
"dvc-studio-client>=0.9.2,<1", "dvc-studio-client>=0.9.2,<1",