Skip to content

Commit

Permalink
dvc.stage.cache: fix typo, was using src filesystem to transfer
Browse files Browse the repository at this point in the history
This was working for LocalFileSystem as they work for any directories/path.
It's hard to test this these days, as we don't have remote tests inside
dvc, so it was not caught.

Potentially fixes #7718.
  • Loading branch information
skshetry authored and efiop committed May 23, 2022
1 parent 60cbcec commit 942a080
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dvc/stage/cache.py
Expand Up @@ -216,7 +216,7 @@ def transfer(self, from_odb, to_odb):
from dvc.fs.callbacks import Callback

from_fs = from_odb.fs
to_fs = from_odb.fs
to_fs = to_odb.fs
func = _log_exceptions(fs.generic.copy)
runs = from_fs.path.join(from_odb.fs_path, "runs")

Expand Down
19 changes: 19 additions & 0 deletions dvc/testing/test_run_cache.py
@@ -0,0 +1,19 @@
import shutil

from .tmp_dir import TmpDir


def test_push_pull(tmp_dir, dvc, remote):
tmp_dir.gen("foo", "foo")
stage = dvc.stage.add(
deps=["foo"], outs=["bar"], name="copy-foo-bar", cmd="cp foo bar"
)
dvc.reproduce(stage.addressing)
assert dvc.push(run_cache=True) == 2

stage_cache_dir = TmpDir(dvc.stage_cache.cache_dir)
expected = list(stage_cache_dir.rglob("*"))
shutil.rmtree(stage_cache_dir)

dvc.pull(run_cache=True)
assert list(stage_cache_dir.rglob("*")) == expected

0 comments on commit 942a080

Please sign in to comment.