From 386e1874bef8783c2c50a30b9fdde8ae08dea76d Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 31 Jul 2024 17:28:25 +0300 Subject: [PATCH] Add retries parameter to StorageManager.upload_folder (#1305) --- clearml/storage/manager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clearml/storage/manager.py b/clearml/storage/manager.py index a4fb8d33..9c35dea6 100644 --- a/clearml/storage/manager.py +++ b/clearml/storage/manager.py @@ -211,8 +211,8 @@ class StorageManager(object): 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. @@ -231,6 +231,7 @@ class StorageManager(object): 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. """ @@ -250,6 +251,7 @@ class StorageManager(object): 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} ) )