Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Oct 10, 2023
1 parent 200b997 commit b2419b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
12 changes: 7 additions & 5 deletions dvc/repo/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ def _collect_indexes( # noqa: PLR0913
types=types,
)

data = idx.data["repo"]
data.onerror = _make_index_onerror(onerror, rev)
idx.data["repo"].onerror = _make_index_onerror(onerror, rev)

indexes[idx.data_tree.hash_info.value] = data
indexes[rev or "workspace"] = idx
except Exception as exc: # pylint: disable=broad-except
if onerror:
onerror(rev, None, exc)
Expand Down Expand Up @@ -138,15 +137,18 @@ def fetch( # noqa: C901, PLR0913
onerror=onerror,
)

cache_key = ("fetch", tokenize(sorted(indexes.keys())))
cache_key = (
"fetch",
tokenize(sorted(idx.data_tree.hash_info.value for idx in indexes.values())),
)

with ui.progress(
desc="Collecting",
unit="entry",
leave=True,
) as pb:
data = collect(
indexes.values(),
[idx.data["repo"] for idx in indexes.values()],
"remote",
cache_index=self.data_index,
cache_key=cache_key,
Expand Down
26 changes: 24 additions & 2 deletions dvc/repo/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ def push( # noqa: C901, PLR0913
revs=revs,
)

cache_key = ("fetch", tokenize(sorted(indexes.keys())))
cache_key = (
"fetch",
tokenize(sorted(idx.data_tree.hash_info.value for idx in indexes.values())),
)

with Callback.as_tqdm_callback(
desc="Collecting",
unit="entry",
) as cb:
data = collect(
indexes.values(),
[idx.data["repo"] for idx in indexes.values()],
"remote",
cache_index=self.data_index,
cache_key=cache_key,
Expand All @@ -82,6 +85,25 @@ def push( # noqa: C901, PLR0913
callback=cb,
) # pylint: disable=assignment-from-no-return
finally:
ws_idx = indexes.get("workspace")
if ws_idx is not None:
from dvc.repo.worktree import _merge_push_meta

stages = set()
for out in ws_idx.outs:
if (
not ws_idx.data["repo"]
.storage_map[out.index_key[1]]
.remote.fs.version_aware
):
continue

_merge_push_meta(out, ws_idx.data["repo"])
stages.add(out.stage)

for stage in stages:
stage.dump(with_files=True, update_pipeline=False)

for fs_index in data:
fs_index.close()

Expand Down

0 comments on commit b2419b1

Please sign in to comment.