exp run: Support --message.

Custom commit message to use when committing the experiment.

Part of #8870
This commit is contained in:
David de la Iglesia Castro
2023-05-08 20:08:47 +02:00
parent 1ba3944944
commit c74dc20b97
15 changed files with 97 additions and 12 deletions
@@ -773,3 +773,19 @@ def test_mixed_git_dvc_out(tmp_dir, scm, dvc, exp_stage):
assert (tmp_dir / "dir" / "metrics.yaml").exists()
git_fs = scm.get_fs(exp)
assert not git_fs.exists("dir/metrics.yaml")
@pytest.mark.parametrize("tmp", [True, False])
def test_custom_commit_message(tmp_dir, scm, dvc, tmp):
stage = dvc.stage.add(
cmd="echo foo",
name="foo",
)
scm.add_commit(["dvc.yaml"], message="add dvc.yaml")
exp = first(
dvc.experiments.run(
stage.addressing, tmp_dir=tmp, message="custom commit message"
)
)
assert scm.gitpython.repo.commit(exp).message == "custom commit message"
+13
View File
@@ -69,3 +69,16 @@ def test_copy_paths_queue(tmp_dir, scm, dvc):
fs = scm.get_fs(exp)
assert not fs.exists("dir")
assert not fs.exists("file")
def test_custom_commit_message_queue(tmp_dir, scm, dvc):
stage = dvc.stage.add(
cmd="echo foo",
name="foo",
)
scm.add_commit(["dvc.yaml"], message="add dvc.yaml")
dvc.experiments.run(stage.addressing, queue=True, message="custom commit message")
exp = first(dvc.experiments.run(run_all=True))
assert scm.gitpython.repo.commit(exp).message == "custom commit message"
+6 -1
View File
@@ -116,7 +116,12 @@ def test_hydra_sweep(
assert patched.call_count == len(expected)
for e in expected:
patched.assert_any_call(
mocker.ANY, params=e, reset=True, targets=None, copy_paths=None
mocker.ANY,
params=e,
reset=True,
targets=None,
copy_paths=None,
message=None,
)
+1
View File
@@ -136,6 +136,7 @@ def test_experiments_run(dvc, scm, mocker):
"reset": False,
"machine": None,
"copy_paths": [],
"message": None,
}
default_arguments.update(repro_arguments)