From d81a1bbf561afd2529434c6dbcb5ba527dd73126 Mon Sep 17 00:00:00 2001 From: dberenbaum Date: Fri, 8 Sep 2023 15:30:27 -0400 Subject: [PATCH] make exp run --dry imply --temp --- dvc/commands/experiments/run.py | 2 +- dvc/repo/experiments/run.py | 3 +++ tests/func/experiments/test_experiments.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dvc/commands/experiments/run.py b/dvc/commands/experiments/run.py index dd8c90cd3..090cae313 100644 --- a/dvc/commands/experiments/run.py +++ b/dvc/commands/experiments/run.py @@ -26,7 +26,7 @@ class CmdExperimentsRun(CmdRepro): def add_parser(experiments_subparsers, parent_parser): - EXPERIMENTS_RUN_HELP = "Run or resume an experiment." + EXPERIMENTS_RUN_HELP = "Run an experiment." experiments_run_parser = experiments_subparsers.add_parser( "run", parents=[parent_parser], diff --git a/dvc/repo/experiments/run.py b/dvc/repo/experiments/run.py index d3c714947..1dd3c42b8 100644 --- a/dvc/repo/experiments/run.py +++ b/dvc/repo/experiments/run.py @@ -30,6 +30,9 @@ def run( # noqa: C901, PLR0912 Returns a dict mapping new experiment SHAs to the results of `repro` for that experiment. """ + if kwargs.get("dry"): + tmp_dir = True + if run_all: return repo.experiments.reproduce_celery(jobs=jobs) diff --git a/tests/func/experiments/test_experiments.py b/tests/func/experiments/test_experiments.py index 1c487306c..29259ac3e 100644 --- a/tests/func/experiments/test_experiments.py +++ b/tests/func/experiments/test_experiments.py @@ -676,10 +676,12 @@ def test_experiment_unchanged(tmp_dir, scm, dvc, exp_stage): assert len(dvc.experiments.ls()[scm.get_rev()]) == 2 -def test_experiment_run_dry(tmp_dir, scm, dvc, exp_stage): +def test_experiment_run_dry(tmp_dir, scm, dvc, exp_stage, mocker): + repro = mocker.spy(dvc.experiments, "reproduce_one") dvc.experiments.run(exp_stage.addressing, dry=True) assert len(dvc.experiments.ls()["master"]) == 0 + assert repro.call_args.kwargs["tmp_dir"] is True def test_clean(tmp_dir, scm, dvc, mocker):