From 544dad75e9256513703d11e336a5edff6ad62941 Mon Sep 17 00:00:00 2001 From: Dave Berenbaum Date: Fri, 28 Jun 2024 16:28:22 -0400 Subject: [PATCH] try force overwriting run cache entries on push --- dvc/stage/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dvc/stage/cache.py b/dvc/stage/cache.py index fe1b4dd78..f97b471cd 100644 --- a/dvc/stage/cache.py +++ b/dvc/stage/cache.py @@ -229,7 +229,7 @@ class StageCache: if not dry: cached_stage.checkout() - def transfer(self, from_odb, to_odb): + def transfer(self, from_odb, to_odb, force=True): from dvc.fs import HTTPFileSystem, LocalFileSystem from dvc.fs.callbacks import TqdmCallback @@ -258,10 +258,11 @@ class StageCache: dst = to_fs.join(to_odb.path, rel) key = to_fs.parent(dst) + # check if any build cache already exists for this key # TODO: check if MaxKeys=1 or something like that applies # or otherwise this will take a lot of time! - if to_fs.exists(key) and first(to_fs.find(key)): + if not force and to_fs.exists(key) and first(to_fs.find(key)): continue src_name = from_fs.name(src)