Skip to content

Commit

Permalink
exp run / repro: Drop --metrics. (#9458)
Browse files Browse the repository at this point in the history
* exp run / repro: Drop `--metrics`.

* exp run: Rename `-M` to `-m`.
  • Loading branch information
daavoo authored May 22, 2023
1 parent f245567 commit 182728d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 49 deletions.
11 changes: 2 additions & 9 deletions dvc/commands/experiments/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

class CmdExperimentsRun(CmdRepro):
def run(self):
from dvc.compare import show_metrics

if self.args.checkpoint_resume:
if self.args.reset:
raise InvalidArgumentError("--reset and --rev are mutually exclusive.")
Expand All @@ -26,7 +24,7 @@ def run(self):
if self.args.reset:
ui.write("Any existing checkpoints will be reset and re-run.")

results = self.repo.experiments.run(
self.repo.experiments.run(
name=self.args.name,
queue=self.args.queue,
run_all=self.args.run_all,
Expand All @@ -41,11 +39,6 @@ def run(self):
**self._common_kwargs,
)

if self.args.metrics and results:
metrics = self.repo.metrics.show(revs=list(results))
metrics.pop("workspace", None)
show_metrics(metrics)

return 0


Expand Down Expand Up @@ -149,7 +142,7 @@ def _add_run_common(parser):
),
)
parser.add_argument(
"-M",
"-m",
"--message",
type=str,
default=None,
Expand Down
13 changes: 0 additions & 13 deletions dvc/commands/repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ def run(self):
else:
ui.write("Use `dvc push` to send your updates to remote storage.")

if self.args.metrics:
from dvc.compare import show_metrics

metrics = self.repo.metrics.show()
show_metrics(metrics)

return 0

@property
Expand Down Expand Up @@ -105,13 +99,6 @@ def add_arguments(repro_parser):
default=False,
help="Reproduce all stages in the specified directory.",
)
repro_parser.add_argument(
"-m",
"--metrics",
action="store_true",
default=False,
help="Show metrics after reproduction.",
)
repro_parser.add_argument(
"--downstream",
action="store_true",
Expand Down
27 changes: 0 additions & 27 deletions tests/func/test_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,33 +889,6 @@ def test_force_import(self, mocker, tmp_dir, dvc):
assert spy_checkout.call_count == 0


def test_should_display_metrics_on_repro_with_metrics_option(caplog, capsys, dvc):
metrics_file = "metrics_file"
metrics_value = 0.123489015
ret = main(
[
"run",
"--single-stage",
"-m",
metrics_file,
f"echo {metrics_value} >> {metrics_file}",
]
)
assert ret == 0

caplog.clear()
capsys.readouterr() # clearing the buffer

from dvc.dvcfile import DVC_FILE_SUFFIX

ret = main(["repro", "--force", "--metrics", metrics_file + DVC_FILE_SUFFIX])
assert ret == 0

expected_metrics_display = f"Path\n{metrics_file} {metrics_value}\n"
actual, _ = capsys.readouterr()
assert expected_metrics_display in actual


@pytest.fixture
def repro_dir(tmp_dir, dvc, run_copy):
# Creates repo with following structure:
Expand Down

0 comments on commit 182728d

Please sign in to comment.