Skip to content

Commit

Permalink
Add retries parameter to StorageManager.upload_folder (#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
allegroai committed Jul 31, 2024
1 parent 165e8a0 commit 386e187
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clearml/storage/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def get_files_server(cls):
return Session.get_files_server_host()

@classmethod
def upload_folder(cls, local_folder, remote_url, match_wildcard=None):
# type: (str, str, Optional[str]) -> Optional[str]
def upload_folder(cls, local_folder, remote_url, match_wildcard=None, retries=None):
# type: (str, str, Optional[str], Optional[int]) -> Optional[str]
"""
Upload local folder recursively to a remote storage, maintaining the sub folder structure
in the remote storage.
Expand All @@ -231,6 +231,7 @@ def upload_folder(cls, local_folder, remote_url, match_wildcard=None):
Example: `*.json`
Notice: target file size/date are not checked. Default True, always upload.
Notice if uploading to http, we will always overwrite the target.
:param int retries: Number of retries before failing to upload a file in the folder.
:return: Newly uploaded remote URL or None on error.
"""

Expand All @@ -250,6 +251,7 @@ def upload_folder(cls, local_folder, remote_url, match_wildcard=None):
pool.apply_async(
helper.upload,
args=(str(path), str(path).replace(local_folder, remote_url)),
kwds={"retries": retries if retries else cls._file_upload_retries}
)
)

Expand Down

0 comments on commit 386e187

Please sign in to comment.