-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exp init: add simple dvc exp init command (#6621)
* exp init: add simple dvc exp init command * Apply suggestions from code review Co-authored-by: Dave Berenbaum <[email protected]> Co-authored-by: Dave Berenbaum <[email protected]>
- Loading branch information
1 parent
21585d1
commit 978d5ac
Showing
2 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
|
||
from dvc.command.experiments import CmdExperimentsInit | ||
from dvc.main import main | ||
from dvc.utils.serialize import load_yaml | ||
|
||
|
||
def test_init(tmp_dir, dvc): | ||
tmp_dir.gen( | ||
{ | ||
CmdExperimentsInit.CODE: {"copy.py": ""}, | ||
"data": "data", | ||
"params.yaml": '{"foo": 1}', | ||
"dvclive": {}, | ||
"plots": {}, | ||
} | ||
) | ||
code_path = os.path.join(CmdExperimentsInit.CODE, "copy.py") | ||
script = f"python {code_path}" | ||
|
||
assert main(["exp", "init", script]) == 0 | ||
assert load_yaml(tmp_dir / "dvc.yaml") == { | ||
"stages": { | ||
"default": { | ||
"cmd": script, | ||
"deps": ["data", "src"], | ||
"live": {"dvclive": {"html": True, "summary": True}}, | ||
"metrics": [{"metrics.json": {"cache": False}}], | ||
"outs": ["models"], | ||
"params": ["foo"], | ||
"plots": [{"plots": {"cache": False}}], | ||
} | ||
} | ||
} |