Skip to content

Commit

Permalink
reproduce: Update pull flag to also pull run cache and mising deps.
Browse files Browse the repository at this point in the history
Closes #4741
  • Loading branch information
daavoo committed May 2, 2023
1 parent 3a05ea7 commit 907cf03
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dvc/repo/reproduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _track_stage(stage: "Stage") -> None:

@locked
@scm_context
def reproduce( # noqa: C901
def reproduce( # noqa: C901, PLR0912
self: "Repo",
targets=None,
recursive=False,
Expand Down Expand Up @@ -125,10 +125,14 @@ def reproduce( # noqa: C901
)
)

if kwargs.get("pull", False):
logger.debug("Pulling run cache")
self.stage_cache.pull(None)

return _reproduce_stages(self.index.graph, list(stages), **kwargs)


def _reproduce_stages( # noqa: C901
def _reproduce_stages( # noqa: C901, PLR0912
graph,
stages,
downstream=False,
Expand Down Expand Up @@ -190,6 +194,12 @@ def _reproduce_stages( # noqa: C901
)

try:
if kwargs.get("pull", False):
for dep in stage.deps:
if not dep.exists:
logger.debug("Pulling missing dependency %s.", dep.def_path)
stage.repo.pull(dep.def_path)

ret = _reproduce_stage(stage, **kwargs)

if len(ret) == 0:
Expand Down

0 comments on commit 907cf03

Please sign in to comment.