Skip to content

Commit

Permalink
exp run: track files for skipped/run-cached stages
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Sep 4, 2023
1 parent 3528c37 commit bf119e7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions dvc/repo/experiments/executor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@ def _from_stash_entry(
**kwargs,
)

@classmethod
def _get_stage_files(cls, stages: List["Stage"]) -> List[str]:
from dvc.stage.utils import _get_stage_files

ret: List[str] = []
for stage in stages:
ret.extend(_get_stage_files(stage))
return ret

@classmethod
def _get_top_level_paths(cls, repo: "Repo") -> List["str"]:
return list(
Expand Down Expand Up @@ -518,10 +509,8 @@ def reproduce(
recursive=kwargs.get("recursive", False),
)

kwargs["repro_fn"] = cls._repro_and_track
stages = dvc.reproduce(*args, **kwargs)
if paths := cls._get_stage_files(stages):
logger.debug("Staging stage-related files: %s", paths)
dvc.scm_context.add(paths)
if paths := cls._get_top_level_paths(dvc):
logger.debug("Staging top-level files: %s", paths)
dvc.scm_context.add(paths)
Expand All @@ -546,6 +535,17 @@ def reproduce(
# multiprocessing calls
return ExecutorResult(exp_hash, exp_ref, repro_force)

@staticmethod
def _repro_and_track(stage: "Stage", **kwargs) -> Optional["Stage"]:
from dvc.repo.reproduce import _reproduce_stage
from dvc.stage.utils import _get_stage_files

ret = _reproduce_stage(stage, **kwargs)
if not kwargs.get("dry") and (paths := _get_stage_files(stage)):
logger.debug("Staging stage-related files: %s", paths)
stage.repo.scm_context.add(paths)
return ret

@classmethod
def _repro_commit(
cls,
Expand Down

0 comments on commit bf119e7

Please sign in to comment.