diff --git a/dvc/cli.py b/dvc/cli.py index f6ec64eb9..af3d7d568 100644 --- a/dvc/cli.py +++ b/dvc/cli.py @@ -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 diff --git a/dvc/command/metrics.py b/dvc/command/metrics.py index ca323dcff..75cb558d4 100644 --- a/dvc/command/metrics.py +++ b/dvc/command/metrics.py @@ -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 diff --git a/dvc/command/repro.py b/dvc/command/repro.py index b5e663514..9cb45afe5 100644 --- a/dvc/command/repro.py +++ b/dvc/command/repro.py @@ -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) diff --git a/dvc/project.py b/dvc/project.py index a3b9ab67b..4eaabcc11 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -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):