mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-25 07:18:30 +01:00
exp run / repro: Drop --metrics. (#9458)
* exp run / repro: Drop `--metrics`. * exp run: Rename `-M` to `-m`.
This commit is contained in:
@@ -13,8 +13,6 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
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.")
|
||||
@@ -26,7 +24,7 @@ class CmdExperimentsRun(CmdRepro):
|
||||
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,
|
||||
@@ -41,11 +39,6 @@ class CmdExperimentsRun(CmdRepro):
|
||||
**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
|
||||
|
||||
|
||||
@@ -149,7 +142,7 @@ def _add_run_common(parser):
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"-M",
|
||||
"-m",
|
||||
"--message",
|
||||
type=str,
|
||||
default=None,
|
||||
|
||||
@@ -16,12 +16,6 @@ class CmdRepro(CmdBase):
|
||||
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
|
||||
@@ -105,13 +99,6 @@ and then the stage name name.
|
||||
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",
|
||||
|
||||
@@ -889,33 +889,6 @@ class TestReproAlreadyCached:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user