Skip to content

Commit

Permalink
output: add progress for commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Aug 3, 2023
1 parent 0f48e29 commit b6f54a1
Showing 1 changed file with 36 additions and 15 deletions.
51 changes: 36 additions & 15 deletions dvc/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,18 @@ def commit(self, filter_info=None, relink=True) -> None:
self.hash_name,
ignore=self.dvcignore,
)
otransfer(
staging,
self.cache,
{obj.hash_info},
shallow=False,
hardlink=hardlink,
)
with Callback.as_tqdm_callback(
desc=f"Committing {self} to cache",
unit="file",
) as cb:
otransfer(
staging,
self.cache,
{obj.hash_info},
shallow=False,
hardlink=hardlink,
callback=cb,
)
if relink:
rel = self.fs.path.relpath(filter_info or self.fs_path)
with CheckoutCallback(desc=f"Checking out {rel}", unit="files") as cb:
Expand Down Expand Up @@ -822,13 +827,18 @@ def _commit_granular_dir(self, filter_info, hardlink) -> Optional["HashFile"]:
save_obj = obj.filter(prefix)
assert isinstance(save_obj, Tree)
checkout_obj = save_obj.get_obj(self.cache, prefix)
otransfer(
staging,
self.cache,
{save_obj.hash_info} | {oid for _, _, oid in save_obj},
shallow=True,
hardlink=hardlink,
)
with Callback.as_tqdm_callback(
desc=f"Committing {self} to cache",
unit="file",
) as cb:
otransfer(
staging,
self.cache,
{save_obj.hash_info} | {oid for _, _, oid in save_obj},
shallow=True,
hardlink=hardlink,
callback=cb,
)
return checkout_obj

def dumpd(self, **kwargs): # noqa: C901, PLR0912
Expand Down Expand Up @@ -1423,7 +1433,18 @@ def add( # noqa: C901

assert staging
assert obj.hash_info
otransfer(staging, self.cache, {obj.hash_info}, hardlink=relink, shallow=False)
with Callback.as_tqdm_callback(
desc=f"Adding {self} to cache",
unit="file",
) as cb:
otransfer(
staging,
self.cache,
{obj.hash_info},
hardlink=relink,
shallow=False,
callback=cb,
)

if relink:
with CheckoutCallback(
Expand Down

0 comments on commit b6f54a1

Please sign in to comment.