Skip to content

Commit

Permalink
repro --pull: always pull deps (#10187)
Browse files Browse the repository at this point in the history
* repro --pull: always pull deps

* drop unused allow_missing args
  • Loading branch information
dberenbaum authored Jan 18, 2024
1 parent b46bd9c commit 5c31189
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dvc/stage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def run(
) or self.is_partial_import:
self._sync_import(dry, force, kwargs.get("jobs", None), no_download)
elif not self.frozen and self.cmd:
self._run_stage(dry, force, allow_missing=allow_missing, **kwargs)
self._run_stage(dry, force, **kwargs)
elif kwargs.get("pull"):
logger.info("Pulling data for %s", self)
self.repo.pull(self.addressing, jobs=kwargs.get("jobs", None))
Expand Down
3 changes: 1 addition & 2 deletions dvc/stage/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ def run_stage(
dry=False,
force=False,
run_env=None,
allow_missing: bool = False,
**kwargs,
):
if not force:
if allow_missing and kwargs.get("pull") and not dry:
if kwargs.get("pull") and not dry:
_pull_missing_deps(stage)

from .cache import RunCacheNotFoundError
Expand Down
12 changes: 12 additions & 0 deletions tests/func/repro/test_repro_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,15 @@ def test_repro_skip_pull_if_no_run_cache_is_passed(tmp_dir, dvc, mocker, local_r

assert dvc.reproduce(pull=True, run_cache=False)
assert not spy_pull.called


def test_repro_skip_pull_if_single_item_is_passed(tmp_dir, dvc, mocker, local_remote):
(foo,) = tmp_dir.dvc_gen("foo", "foo")

dvc.push()

dvc.stage.add(name="copy-foo", cmd="cp foo bar", deps=["foo"], outs=["bar"])
remove("foo")
remove(foo.outs[0].cache_path)

assert dvc.reproduce(pull=True, single_item=True)

0 comments on commit 5c31189

Please sign in to comment.