diff --git a/dvc/output/base.py b/dvc/output/base.py index 8b55bd71f..493266041 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -277,6 +277,7 @@ class OutputBase(object): def checkout(self, force=False, progress_callback=None, tag=None): if not self.use_cache: + progress_callback(str(self.path_info), self.get_files_number()) return if tag: diff --git a/dvc/remote/base.py b/dvc/remote/base.py index 62dbba705..59d3d70ed 100644 --- a/dvc/remote/base.py +++ b/dvc/remote/base.py @@ -739,23 +739,28 @@ class RemoteBASE(object): raise NotImplementedError checksum = checksum_info.get(self.PARAM_CHECKSUM) + skip = False if not checksum: logger.warning( "No checksum info found for '{}'. " "It won't be created.".format(str(path_info)) ) self.safe_remove(path_info, force=force) - return + skip = True if not self.changed(path_info, checksum_info): msg = "Data '{}' didn't change." logger.debug(msg.format(str(path_info))) - return + skip = True if self.changed_cache(checksum): msg = "Cache '{}' not found. File '{}' won't be created." logger.warning(msg.format(checksum, str(path_info))) self.safe_remove(path_info, force=force) + skip = True + + if skip: + progress_callback(str(path_info), self.get_files_number(checksum)) return msg = "Checking out '{}' with cache '{}'." @@ -774,6 +779,15 @@ class RemoteBASE(object): path_info, checksum, force, progress_callback=progress_callback ) + def get_files_number(self, checksum): + if not checksum: + return 0 + + if self.is_dir_checksum(checksum): + return len(self.get_dir_cache(checksum)) + + return 1 + @staticmethod def unprotect(path_info): pass diff --git a/dvc/remote/ssh/__init__.py b/dvc/remote/ssh/__init__.py index ea8e89938..086a2fd71 100644 --- a/dvc/remote/ssh/__init__.py +++ b/dvc/remote/ssh/__init__.py @@ -277,3 +277,5 @@ class RemoteSSH(RemoteBASE): in_remote = itertools.chain.from_iterable(results) ret = list(itertools.compress(checksums, in_remote)) return ret + + pbar.update_desc("", 0) # clear path name description diff --git a/dvc/repo/checkout.py b/dvc/repo/checkout.py index 3430f9436..e335763a2 100644 --- a/dvc/repo/checkout.py +++ b/dvc/repo/checkout.py @@ -50,8 +50,5 @@ def checkout(self, target=None, with_deps=False, force=False, recursive=False): ) ) - done = pbar.n stage.checkout(force=force, progress_callback=pbar.update_desc) - if done == pbar.n: - # callback not called - pbar.update(stage.get_all_files_number()) + pbar.update_desc("Checkout", 0) # clear path name description