MCPcopy
hub / github.com/treeverse/dvc / fetch

Function fetch

dvc/repo/fetch.py:101–207  ·  view source on GitHub ↗

Download data items from a cloud and imported repositories Returns: int: number of successfully downloaded files Raises: DownloadError: thrown when there are failed downloads, either during `cloud.pull` or trying to fetch imported files config.NoRemoteE

(  # noqa: PLR0913
    self: "Repo",
    targets=None,
    jobs=None,
    remote=None,
    all_branches=False,
    with_deps=False,
    all_tags=False,
    recursive=False,
    all_commits=False,
    run_cache=False,
    revs=None,
    workspace=True,
    max_size=None,
    types=None,
    config=None,
    onerror=None,
)

Source from the content-addressed store, hash-verified

99
100@locked
101def fetch( # noqa: PLR0913
102 self: "Repo",
103 targets=None,
104 jobs=None,
105 remote=None,
106 all_branches=False,
107 with_deps=False,
108 all_tags=False,
109 recursive=False,
110 all_commits=False,
111 run_cache=False,
112 revs=None,
113 workspace=True,
114 max_size=None,
115 types=None,
116 config=None,
117 onerror=None,
118) -> int:
119 """Download data items from a cloud and imported repositories
120
121 Returns:
122 int: number of successfully downloaded files
123
124 Raises:
125 DownloadError: thrown when there are failed downloads, either
126 during `cloud.pull` or trying to fetch imported files
127
128 config.NoRemoteError: thrown when downloading only local files and no
129 remote is configured
130 """
131 from fsspec.utils import tokenize
132
133 from dvc_data.index.fetch import collect
134 from dvc_data.index.fetch import fetch as ifetch
135
136 if isinstance(targets, str):
137 targets = [targets]
138
139 failed_count = 0
140 transferred_count = 0
141
142 try:
143 if run_cache:
144 self.stage_cache.pull(remote)
145 except RunCacheNotSupported as e:
146 logger.debug("failed to pull run cache: %s", e)
147 except DownloadError as exc:
148 failed_count += exc.amount
149
150 indexes = _collect_indexes(
151 self,
152 targets=targets,
153 remote=remote,
154 all_branches=all_branches,
155 with_deps=with_deps,
156 all_tags=all_tags,
157 recursive=recursive,
158 all_commits=all_commits,

Callers

nothing calls this directly

Calls 9

DownloadErrorClass · 0.90
_collect_indexesFunction · 0.85
_log_unversionedFunction · 0.85
as_callbackMethod · 0.80
drop_data_indexMethod · 0.80
collectFunction · 0.70
pullMethod · 0.45
progressMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected