mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
repro: print correct dvc file name near with error message
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.command.common.base import CmdBase
|
||||
from dvc.project import ReproductionError
|
||||
|
||||
|
||||
class CmdRepro(CmdBase):
|
||||
def run(self):
|
||||
@@ -9,8 +10,10 @@ class CmdRepro(CmdBase):
|
||||
self.project.reproduce(target,
|
||||
recursive=recursive,
|
||||
force=self.args.force)
|
||||
except DvcException as ex:
|
||||
msg = 'Failed to reproduce {}: {}'.format(target, str(ex))
|
||||
except ReproductionError as ex:
|
||||
self.project.logger.error(ex)
|
||||
except Exception as ex:
|
||||
msg = 'Failed to reproduce \'{}\' - unexpected error: {}'.format(target, ex)
|
||||
self.project.logger.error(msg)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
+11
-3
@@ -26,6 +26,11 @@ class StageNotFoundError(DvcException):
|
||||
super(StageNotFoundError, self).__init__(msg)
|
||||
|
||||
|
||||
class ReproductionError(DvcException):
|
||||
def __init__(self, dvc_file_name, msg):
|
||||
super(ReproductionError, self).__init__(u'Failed to reproduce \'{}\': {}'.format(dvc_file_name, msg))
|
||||
|
||||
|
||||
class Pipeline(object):
|
||||
|
||||
def __init__(self, project, G):
|
||||
@@ -176,9 +181,12 @@ class Project(object):
|
||||
|
||||
if recursive:
|
||||
for n in nx.dfs_postorder_nodes(self.graph(), node):
|
||||
stages[n].reproduce(force=force)
|
||||
stages[n].dump()
|
||||
reproduced.append(stages[n])
|
||||
try:
|
||||
stages[n].reproduce(force=force)
|
||||
stages[n].dump()
|
||||
reproduced.append(stages[n])
|
||||
except Exception as ex:
|
||||
raise ReproductionError(n, ex.message)
|
||||
|
||||
stages[node].reproduce(force=force)
|
||||
stages[node].dump()
|
||||
|
||||
Reference in New Issue
Block a user