More error information is needed wrt. remote files (#1737)

As described in #1735, I think DVC needs to output more info about remote files,
Thus, I have added this to stage.py.
Additionally, I think that DVC should not crash if the SSH client is trying to remove a fil which already does not exists. This, I have implemented the catch of the FileNotFoundError : [Errno 2] No such file exception.

Fixes #1735
This commit is contained in:
Peter Fogh
2019-03-23 00:36:46 +02:00
committed by Ruslan Kuprieiev
parent 2ba657c77a
commit ac15a42eac
3 changed files with 25 additions and 10 deletions
+3
View File
@@ -27,3 +27,6 @@ innosetup/config.ini
dvc/version.py
*.swp
pip-wheel-metadata/
.vscode/
+6 -1
View File
@@ -1,3 +1,4 @@
import errno
import os
import posixpath
@@ -143,7 +144,11 @@ class SSHConnection:
def remove(self, path):
self._sftp_connect()
self._sftp.remove(path)
try:
self._sftp.remove(path)
except IOError as exc:
if exc.errno != errno.ENOENT:
raise
def download(self, src, dest, no_progress_bar=False, progress_title=None):
self._sftp_connect()
+16 -9
View File
@@ -211,10 +211,12 @@ class Stage(object):
return True
for dep in self.deps:
if dep.changed():
status = dep.status()
if status:
logger.warning(
"Dependency '{dep}' of '{stage}' changed.".format(
dep=dep, stage=self.relpath
"Dependency '{dep}' of '{stage}' changed because it is "
"'{status}'.".format(
dep=dep, stage=self.relpath, status=status[str(dep)]
)
)
return True
@@ -223,10 +225,12 @@ class Stage(object):
def _changed_outs(self):
for out in self.outs:
if out.changed():
status = out.status()
if status:
logger.warning(
"Output '{out}' of '{stage}' changed.".format(
out=out, stage=self.relpath
"Output '{out}' of '{stage}' changed because it is "
"'{status}'".format(
out=out, stage=self.relpath, status=status[str(out)]
)
)
return True
@@ -256,10 +260,13 @@ class Stage(object):
return ret
def remove_outs(self, ignore_remove=False):
"""
Used mainly for `dvc remove --outs`
"""
"""Used mainly for `dvc remove --outs` and :func:`Stage.reproduce`."""
for out in self.outs:
logger.debug(
"Removing output '{out}' of '{stage}'.".format(
out=out, stage=self.relpath
)
)
out.remove(ignore_remove=ignore_remove)
def unprotect_outs(self):