Skip to content

Commit

Permalink
More error information is needed wrt. remote files (iterative#1737)
Browse files Browse the repository at this point in the history
As described in iterative#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 iterative#1735
  • Loading branch information
PeterFogh authored and efiop committed Mar 22, 2019
1 parent 2ba657c commit ac15a42
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ innosetup/config.ini
dvc/version.py

*.swp

pip-wheel-metadata/
.vscode/
7 changes: 6 additions & 1 deletion dvc/remote/ssh/connection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import errno
import os
import posixpath

Expand Down Expand Up @@ -143,7 +144,11 @@ def walk_files(self, directory):

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()
Expand Down
25 changes: 16 additions & 9 deletions dvc/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,12 @@ def _changed_deps(self):
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
Expand All @@ -223,10 +225,12 @@ def _changed_deps(self):

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
Expand Down Expand Up @@ -256,10 +260,13 @@ def changed(self):
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):
Expand Down

0 comments on commit ac15a42

Please sign in to comment.