diff --git a/dvc/repo/experiments/__init__.py b/dvc/repo/experiments/__init__.py index 345dcf807b..b36205378c 100644 --- a/dvc/repo/experiments/__init__.py +++ b/dvc/repo/experiments/__init__.py @@ -725,10 +725,14 @@ def _workspace_repro(self) -> Mapping[str, str]: rel_cwd=relpath(os.getcwd(), self.scm.root_dir), ) - if not exec_result.exp_hash or not exec_result.ref_info: + if not exec_result.exp_hash: raise DvcException( f"Failed to reproduce experiment '{rev[:7]}'" ) + if not exec_result.ref_info: + # repro succeeded but result matches baseline + # (no experiment generated or applied) + return {} exp_rev = self.scm.get_ref(str(exec_result.ref_info)) self.scm.set_ref(EXEC_APPLY, exp_rev) return {exp_rev: exec_result.exp_hash} diff --git a/dvc/repo/experiments/executor/base.py b/dvc/repo/experiments/executor/base.py index ce5cd920ea..b0f4f48ea7 100644 --- a/dvc/repo/experiments/executor/base.py +++ b/dvc/repo/experiments/executor/base.py @@ -358,6 +358,8 @@ def _repro_args(cls, dvc): if os.path.exists(args_path): args, kwargs = cls.unpack_repro_args(args_path) remove(args_path) + # explicitly git rm/unstage the args file + dvc.scm.add([args_path]) else: args = [] kwargs = {}