repro: Continue on RunCacheNotSupported

Closes #9470
This commit is contained in:
daavoo
2023-05-25 16:35:30 +02:00
committed by David de la Iglesia Castro
parent 192c9cc577
commit e98bf38d4c
2 changed files with 20 additions and 1 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Iterator, List
from dvc.exceptions import ReproductionError
from dvc.repo.scm_context import scm_context
from dvc.stage.cache import RunCacheNotSupported
from . import locked
@@ -108,7 +109,10 @@ def reproduce( # noqa: C901, PLR0912
if kwargs.get("pull", False):
logger.debug("Pulling run cache")
self.stage_cache.pull(None)
try:
self.stage_cache.pull(None)
except RunCacheNotSupported:
logger.debug("Failed to pull run cache")
return _reproduce_stages(self.index.graph, list(stages), **kwargs)
+15
View File
@@ -9,6 +9,7 @@ from dvc.cli import main
from dvc.dvcfile import LOCK_FILE, PROJECT_FILE
from dvc.exceptions import CyclicGraphError, ReproductionError
from dvc.stage import PipelineStage
from dvc.stage.cache import RunCacheNotSupported
from dvc.stage.exceptions import StageNotFound
from dvc.utils.fs import remove
@@ -481,3 +482,17 @@ def test_repro_allow_missing_and_pull(tmp_dir, dvc, mocker, local_remote):
ret = dvc.reproduce(pull=True, allow_missing=True)
# create-foo is skipped ; copy-foo pulls missing dep
assert len(ret) == 1
def test_repro_pulls_continue_without_run_cache(tmp_dir, dvc, mocker, local_remote):
(foo,) = tmp_dir.dvc_gen("foo", "foo")
dvc.push()
mocker.patch.object(
dvc.stage_cache, "pull", side_effect=RunCacheNotSupported("foo")
)
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)