hydra: Raise error when name and sweeps.

This commit is contained in:
David de la Iglesia Castro
2022-11-14 21:34:55 +01:00
parent 87d8269365
commit e4ea463c73
2 changed files with 18 additions and 1 deletions
+4
View File
@@ -61,6 +61,10 @@ def run(
)
if hydra_sweep:
if kwargs.get("name"):
raise InvalidArgumentError(
"Sweep overrides can't be used alongside `--name`"
)
from dvc.utils.hydra import get_hydra_sweeps
sweeps = get_hydra_sweeps(path_overrides)
+14 -1
View File
@@ -144,5 +144,18 @@ def test_hydra_sweep(
def test_hydra_sweep_requires_queue(params_repo, dvc):
with pytest.raises(InvalidArgumentError):
with pytest.raises(
InvalidArgumentError,
match="Sweep overrides can't be used without `--queue`",
):
dvc.experiments.run(params=["db=mysql,postgresql"])
def test_hydra_sweep_cant_use_name(tmp_dir, params_repo, dvc):
with pytest.raises(
InvalidArgumentError,
match="Sweep overrides can't be used alongside `--name`",
):
dvc.experiments.run(
params=["db=mysql,postgresql"], queue=True, name="foo"
)