mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-04 23:09:44 +01:00
* experiments: commit to refs/exps/... instead of branch heads * update exp show * restore checkpoint_resume kwarg * refactor new() to use experiments stash * experiments: use refspecs to populate and collect executors * experiments: use new stash and merge on exp checkout * experiments: fix executor chdir * experiments: update run and show * skip checkout after reproduce * checkpoints: use experiments refspecs * check if workspace was stashed before applying * exp show: unify checkpoint/standalone experiment collection * git: move iter_refs to backend * update for scm changes * experiments: replace exp checkout in favor of exp apply * git: handle rev_parse errors in resolve_commit * update refs containing and baseline check * fix sigint handling for checkpoints * update checkpoint exists behavior * fix checkpoint baseline behavior * update tests * experiments: update gc * update show tests * fix type checking errors * update diff * scm: add diff, describe * experiments: generate human readable names * exp run/resume: allow user specified exp name with -n/--name * update tests * experiments: add `exp branch` for promoting experiment to full branch * fix test * fix missing file * experiments: explicitly close scm instances before cleaning up tmp dir
31 lines
1022 B
Python
31 lines
1022 B
Python
from funcy import first
|
|
|
|
|
|
def test_diff_empty(tmp_dir, scm, dvc, exp_stage):
|
|
assert dvc.experiments.diff() == {
|
|
"params": {},
|
|
"metrics": {},
|
|
}
|
|
|
|
|
|
def test_diff_head(tmp_dir, scm, dvc, exp_stage):
|
|
results = dvc.experiments.run(exp_stage.addressing, params=["foo=2"])
|
|
exp = first(results)
|
|
|
|
assert dvc.experiments.diff(a_rev="HEAD", b_rev=exp) == {
|
|
"params": {"params.yaml": {"foo": {"diff": 1, "old": 1, "new": 2}}},
|
|
"metrics": {"metrics.yaml": {"foo": {"diff": 1, "old": 1, "new": 2}}},
|
|
}
|
|
|
|
|
|
def test_diff_exp(tmp_dir, scm, dvc, exp_stage):
|
|
results = dvc.experiments.run(exp_stage.addressing, params=["foo=2"])
|
|
exp_a = first(results)
|
|
results = dvc.experiments.run(exp_stage.addressing, params=["foo=3"])
|
|
exp_b = first(results)
|
|
|
|
assert dvc.experiments.diff(a_rev=exp_a, b_rev=exp_b) == {
|
|
"params": {"params.yaml": {"foo": {"diff": 1, "old": 2, "new": 3}}},
|
|
"metrics": {"metrics.yaml": {"foo": {"diff": 1, "old": 2, "new": 3}}},
|
|
}
|