Skip to content

Commit

Permalink
Allow copy_from_local for GoogleCloudStorageResource to retry on Conn…
Browse files Browse the repository at this point in the history
…ectionError ('Connection aborted')
  • Loading branch information
Thierry RAMORASOAVINA committed Dec 11, 2024
1 parent fdbf1fe commit e31be79
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion khiops/core/internals/filesystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,15 @@ def remove(self):
self.blob.delete()

def copy_from_local(self, local_path):
self.blob.upload_from_filename(local_path)
# For a destination object that should not yet exist,
# set the if_generation_match precondition to 0.
# In this case the retries are enabled for a ConnectionError
# otherwise no retry is performed by default
generation_match_precondition = 0

self.blob.upload_from_filename(
local_path, if_generation_match=generation_match_precondition
)

def copy_to_local(self, local_path):
self.blob.download_to_filename(local_path)
Expand Down

0 comments on commit e31be79

Please sign in to comment.