exp init: add config support (#6761)

This commit is contained in:
Saugat Pachhai
2021-10-08 20:14:01 +05:45
committed by GitHub
parent 50cdf4f213
commit 4e17279440
3 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -808,7 +808,7 @@ class CmdExperimentsInit(CmdBase):
defaults = {}
if not self.args.explicit:
config = {} # TODO
config = self.repo.config["exp"]
defaults.update({**self.DEFAULTS, **config})
cli_args = compact(
+9
View File
@@ -256,4 +256,13 @@ SCHEMA = {
Optional("parametrization", default=True): Bool,
},
"plots": {"html_template": str},
"exp": {
"code": str,
"data": str,
"models": str,
"metrics": str,
"params": str,
"plots": str,
"live": str,
},
}
+20
View File
@@ -405,3 +405,23 @@ def test_show_experiments(capsys):
"3000,1,0.5843640011189556,0.9544670443829399,3000,1,20170428,100,36"
in cap.out
)
def test_experiments_init_config(dvc, mocker):
with dvc.config.edit() as conf:
conf["exp"] = {"code": "new_src", "models": "new_models"}
m = mocker.patch("dvc.repo.experiments.init.init")
cli_args = parse_args(["exp", "init", "cmd"])
cmd = cli_args.func(cli_args)
assert cmd.run() == 0
assert m.call_args[1]["defaults"] == {
"code": "new_src",
"models": "new_models",
"data": "data",
"metrics": "metrics.json",
"params": "params.yaml",
"plots": "plots",
"live": "dvclive",
}