dvc: introduce -m option for repro

Fixes #188

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-06-16 16:01:32 +03:00
parent c733b8130b
commit 83d831735c
4 changed files with 18 additions and 10 deletions
+5
View File
@@ -245,6 +245,11 @@ def parse_args(argv=None):
'--cwd',
default=os.path.curdir,
help='Directory to reproduce from.')
repro_parser.add_argument('-m',
'--metrics',
action='store_true',
default=False,
help='Show metrics after reproduction')
repro_parser.set_defaults(func=CmdRepro)
# Remove
+5 -10
View File
@@ -3,16 +3,11 @@ from dvc.command.common.base import CmdBase
class CmdMetricsShow(CmdBase):
def run(self):
res = self.project.metrics_show(self.args.path,
json_path=self.args.json_path,
tsv_path=self.args.tsv_path,
htsv_path=self.args.htsv_path,
all_branches=self.args.all_branches)
for branch, val in res.items():
self.project.logger.info('{}:'.format(branch))
for fname, metric in val.items():
self.project.logger.info('\t{}: {}'.format(fname, metric))
self.project.metrics_show(self.args.path,
json_path=self.args.json_path,
tsv_path=self.args.tsv_path,
htsv_path=self.args.htsv_path,
all_branches=self.args.all_branches)
return 0
+2
View File
@@ -18,6 +18,8 @@ class CmdRepro(CmdBase):
self.project.reproduce(target,
recursive=recursive,
force=self.args.force)
if self.args.metrics:
self.project.metrics_show()
except ReproductionError as ex:
msg = 'Failed to reproduce \'{}\''.format(target)
self.project.logger.error(msg, ex)
+6
View File
@@ -359,6 +359,12 @@ class Project(object):
self.scm.checkout(saved)
self.checkout()
for branch, val in res.items():
self.logger.info('{}:'.format(branch))
for fname, metric in val.items():
self.logger.info('\t{}: {}'.format(fname, metric))
return res
def _metrics_modify(self, path, val):