mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exp: fix tests and remove reset checks
This commit is contained in:
@@ -258,8 +258,7 @@ class Experiments:
|
||||
exp_ref = ExpRefInfo(baseline_sha=baseline_sha, name=name)
|
||||
check_ref_format(self.scm, exp_ref)
|
||||
force = kwargs.get("force", False)
|
||||
reset = kwargs.get("reset", False)
|
||||
if self.scm.get_ref(str(exp_ref)) and not (force or reset):
|
||||
if self.scm.get_ref(str(exp_ref)) and not force:
|
||||
raise ExperimentExistsError(exp_ref.name)
|
||||
|
||||
return queue.put(*args, **kwargs)
|
||||
|
||||
@@ -492,7 +492,6 @@ class BaseExecutor(ABC):
|
||||
info,
|
||||
stages,
|
||||
exp_hash,
|
||||
checkpoint_reset,
|
||||
auto_push,
|
||||
git_remote,
|
||||
repro_force,
|
||||
@@ -513,17 +512,11 @@ class BaseExecutor(ABC):
|
||||
info,
|
||||
stages,
|
||||
exp_hash,
|
||||
checkpoint_reset,
|
||||
auto_push,
|
||||
git_remote,
|
||||
repro_force,
|
||||
) -> Tuple[Optional[str], Optional["ExpRefInfo"], bool]:
|
||||
is_checkpoint = any(stage.is_checkpoint for stage in stages)
|
||||
if is_checkpoint and checkpoint_reset:
|
||||
# For reset checkpoint stages, we need to force
|
||||
# overwriting existing checkpoint refs even though
|
||||
# repro may not have actually been run with --force
|
||||
repro_force = True
|
||||
cls.commit(
|
||||
dvc.scm,
|
||||
exp_hash,
|
||||
|
||||
@@ -90,14 +90,11 @@ def test_resume_checkpoint(
|
||||
def test_reset_checkpoint(
|
||||
tmp_dir, scm, dvc, checkpoint_stage, caplog, workspace
|
||||
):
|
||||
dvc.experiments.run(
|
||||
checkpoint_stage.addressing, name="foo", tmp_dir=not workspace
|
||||
)
|
||||
dvc.experiments.run(checkpoint_stage.addressing, tmp_dir=not workspace)
|
||||
|
||||
results = dvc.experiments.run(
|
||||
checkpoint_stage.addressing,
|
||||
params=["foo=2"],
|
||||
name="foo",
|
||||
tmp_dir=not workspace,
|
||||
reset=True,
|
||||
)
|
||||
@@ -228,7 +225,8 @@ def test_auto_push_during_iterations(
|
||||
ref_info = first(exp_refs_by_rev(scm, exp))
|
||||
assert git_upstream.tmp_dir.scm.get_ref(str(ref_info)) == exp
|
||||
|
||||
assert auto_push_spy.call_count == 2
|
||||
# Assert 3 pushes: 2 checkpoints and final commit
|
||||
assert auto_push_spy.call_count == 3
|
||||
assert auto_push_spy.call_args[0][2] == remote
|
||||
|
||||
|
||||
@@ -288,7 +286,8 @@ def test_tmp_dir_failed_checkpoint(
|
||||
exp = first(results)
|
||||
|
||||
result = dvc.experiments.show()[baseline]
|
||||
assert len(result) == 1 + 2
|
||||
# Assert 4 rows: baseline, 2 checkpoints, and final commit
|
||||
assert len(result) == 4
|
||||
assert exp in result
|
||||
assert (
|
||||
"Checkpoint stage 'failed-checkpoint-file' was interrupted remaining "
|
||||
|
||||
@@ -245,7 +245,8 @@ def test_show_checkpoint(
|
||||
exp_rev = first(results)
|
||||
|
||||
results = dvc.experiments.show()[baseline_rev]
|
||||
assert len(results) == checkpoint_stage.iterations + 1
|
||||
# Assert 4 rows: baseline, 2 checkpoints, and final commit
|
||||
assert len(results) == checkpoint_stage.iterations + 2
|
||||
|
||||
checkpoints = []
|
||||
for rev, exp in results.items():
|
||||
@@ -1049,7 +1050,8 @@ def test_show_checkpoint_error(tmp_dir, scm, dvc, checkpoint_stage, mocker):
|
||||
exp_ref = str(first(exp_refs_by_rev(scm, exp_rev)))
|
||||
|
||||
results = dvc.experiments.show()[baseline_rev]
|
||||
assert len(results) == checkpoint_stage.iterations + 1
|
||||
# Assert 4 rows: baseline, 2 checkpoints, and final commit
|
||||
assert len(results) == checkpoint_stage.iterations + 2
|
||||
|
||||
checkpoints = {}
|
||||
for rev in results:
|
||||
|
||||
Reference in New Issue
Block a user