repro: Skip pulling run cache if no-run-cache was passed.

This commit is contained in:
daavoo
2023-05-25 16:35:30 +02:00
committed by David de la Iglesia Castro
parent e98bf38d4c
commit 5a6f834088
2 changed files with 16 additions and 3 deletions
+3 -3
View File
@@ -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)
+13
View File
@@ -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