Skip to content

Commit

Permalink
try force overwriting run cache entries on push
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Berenbaum authored and dberenbaum committed Jul 24, 2024
1 parent 8f50f25 commit 544dad7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dvc/stage/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def restore(self, stage, run_cache=True, pull=False, dry=False): # noqa: C901
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

Expand Down Expand Up @@ -258,10 +258,11 @@ def transfer(self, from_odb, to_odb):

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)
Expand Down

0 comments on commit 544dad7

Please sign in to comment.