diff --git a/dvc/repo/reproduce.py b/dvc/repo/reproduce.py index 30365f8c4..aa4de4c9e 100644 --- a/dvc/repo/reproduce.py +++ b/dvc/repo/reproduce.py @@ -107,12 +107,12 @@ def reproduce( # noqa: C901, PLR0912 ) ) - if kwargs.get("pull", False): + if kwargs.get("pull", False) and kwargs.get("run_cache", True): logger.debug("Pulling run cache") try: self.stage_cache.pull(None) - except RunCacheNotSupported: - logger.debug("Failed to pull run cache") + except RunCacheNotSupported as e: + logger.warning("Failed to pull run cache: %s", e) return _reproduce_stages(self.index.graph, list(stages), **kwargs) diff --git a/tests/func/test_repro_multistage.py b/tests/func/test_repro_multistage.py index 9cf8856fd..421e7c3f4 100644 --- a/tests/func/test_repro_multistage.py +++ b/tests/func/test_repro_multistage.py @@ -496,3 +496,16 @@ def test_repro_pulls_continue_without_run_cache(tmp_dir, dvc, mocker, local_remo remove(foo.outs[0].cache_path) assert dvc.reproduce(pull=True) + + +def test_repro_skip_pull_if_no_run_cache_is_passed(tmp_dir, dvc, mocker, local_remote): + (foo,) = tmp_dir.dvc_gen("foo", "foo") + + dvc.push() + spy_pull = mocker.spy(dvc.stage_cache, "pull") + 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, run_cache=False) + assert not spy_pull.called