mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
fix uncalled progress_callbacks
This commit is contained in:
@@ -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:
|
||||
|
||||
+16
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user