mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* studio: Move `post_live_metrics` from `queue/workspace` to `executor/base`. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update dvc/repo/experiments/utils.py Co-authored-by: skshetry <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: skshetry <[email protected]>
30 lines
880 B
Python
30 lines
880 B
Python
from funcy import first
|
|
|
|
|
|
def test_generate_random_exp_name(tmp_dir, dvc, scm, exp_stage, mocker):
|
|
mocker.patch(
|
|
"dvc.repo.experiments.utils.random.choice",
|
|
side_effect=[
|
|
0,
|
|
0,
|
|
0,
|
|
0,
|
|
1,
|
|
1,
|
|
0,
|
|
0,
|
|
],
|
|
)
|
|
|
|
ref = first(dvc.experiments.run(exp_stage.addressing, params=["foo=1"]))
|
|
assert dvc.experiments.get_exact_name([ref])[ref] == "0-0"
|
|
|
|
# Causes 1 retry
|
|
ref = first(dvc.experiments.run(exp_stage.addressing, params=["foo=2"]))
|
|
assert dvc.experiments.get_exact_name([ref])[ref] == "1-1"
|
|
|
|
tmp_dir.scm_gen({"foo": "bar"}, commit="foo")
|
|
# Can use same name because of different baseline_rev
|
|
ref = first(dvc.experiments.run(exp_stage.addressing, params=["foo=1"]))
|
|
assert dvc.experiments.get_exact_name([ref])[ref] == "0-0"
|