Skip to content

Commit

Permalink
Use progress_callback in ssh/local list_cache_paths()
Browse files Browse the repository at this point in the history
- keep ssh/local consistent with other remotes (even though `dvc
  gc`/`RemoteBASE.all()` do not currently use progress bars)
  • Loading branch information
pmrowla committed Mar 27, 2020
1 parent 56c2942 commit b200d7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dvc/remote/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ def supported(cls, config):
def list_cache_paths(self, prefix=None, progress_callback=None):
assert prefix is None
assert self.path_info is not None
return walk_files(self.path_info)
if progress_callback:
for path in walk_files(self.path_info):
progress_callback()
yield path
else:
yield from walk_files(self.path_info)

def get(self, md5):
if not md5:
Expand Down
7 changes: 6 additions & 1 deletion dvc/remote/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ def list_cache_paths(self, prefix=None, progress_callback=None):
assert prefix is None
with self.ssh(self.path_info) as ssh:
# If we simply return an iterator then with above closes instantly
yield from ssh.walk_files(self.path_info.path)
if progress_callback:
for path in ssh.walk_files(self.path_info.path):
progress_callback()
yield path
else:
yield from ssh.walk_files(self.path_info.path)

def walk_files(self, path_info):
with self.ssh(path_info) as ssh:
Expand Down

0 comments on commit b200d7d

Please sign in to comment.