runcache: fix push from Windows to remote filesystems

We were passing paths with '\\' in the filename instead of posix paths to
remote filesystems which was causing failures to upload.
Although in some filesystems, this was failing silently, so upload would seem
to have passed, but the download later would fail.
This commit is contained in:
Saugat Pachhai (सौगात)
2022-06-11 11:34:12 +03:00
committed by Ruslan Kuprieiev
parent 9ac2f49b57
commit e6db6ffc89
+4
View File
@@ -213,6 +213,7 @@ class StageCache:
cached_stage.checkout()
def transfer(self, from_odb, to_odb):
from dvc.fs import LocalFileSystem
from dvc.fs.callbacks import Callback
from_fs = from_odb.fs
@@ -226,6 +227,9 @@ class StageCache:
for src in from_fs.find(runs):
rel = from_fs.path.relpath(src, from_odb.fs_path)
if not isinstance(to_fs, LocalFileSystem):
rel = from_fs.path.as_posix(rel)
dst = to_fs.path.join(to_odb.fs_path, rel)
key = to_fs.path.parent(dst)
# check if any build cache already exists for this key