diff --git a/dvc/repo/experiments/__init__.py b/dvc/repo/experiments/__init__.py index a6b19b90e..bcf888bdf 100644 --- a/dvc/repo/experiments/__init__.py +++ b/dvc/repo/experiments/__init__.py @@ -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) diff --git a/dvc/repo/experiments/executor/base.py b/dvc/repo/experiments/executor/base.py index 8d519f2b6..45ef7c3c4 100644 --- a/dvc/repo/experiments/executor/base.py +++ b/dvc/repo/experiments/executor/base.py @@ -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, diff --git a/tests/func/experiments/test_checkpoints.py b/tests/func/experiments/test_checkpoints.py index 77922d996..5b3b2bf82 100644 --- a/tests/func/experiments/test_checkpoints.py +++ b/tests/func/experiments/test_checkpoints.py @@ -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 " diff --git a/tests/func/experiments/test_show.py b/tests/func/experiments/test_show.py index 56d2214c7..973144766 100644 --- a/tests/func/experiments/test_show.py +++ b/tests/func/experiments/test_show.py @@ -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: