diff --git a/components/clp-py-utils/clp_py_utils/s3_utils.py b/components/clp-py-utils/clp_py_utils/s3_utils.py index ddf386268..03717a445 100644 --- a/components/clp-py-utils/clp_py_utils/s3_utils.py +++ b/components/clp-py-utils/clp_py_utils/s3_utils.py @@ -12,20 +12,19 @@ def s3_put( s3_config: S3Config, src_file: Path, dest_file_name: str, total_max_attempts: int = 3 ) -> Result[bool, str]: """ - Upload a local file to S3 bucket using AWS's PutObject operation. - :param s3_config: S3 configuration specifies the upload destination and credentials. - :param src_file: local file to upload. - :param dest_file_name: The name for uploaded file in the S3 bucket. - :param total_max_attempts: Maximum number of retry attempts for the upload. Defaults to 3. - :return: Result.OK(bool) on success. - Result.Err(str) with the error message if put operation fails. + Uploads a local file to an S3 bucket using AWS's PutObject operation. + :param s3_config: S3 configuration specifying the upload destination and credentials. + :param src_file: Local file to upload. + :param dest_file_name: The name for the uploaded file in the S3 bucket. + :param total_max_attempts: Maximum number of retry attempts for the upload. + :return: Result.OK(bool) on success, or Result.Err(str) with the error message otherwise. """ if not src_file.exists(): return Err(f"{src_file} doesn't exist") if not src_file.is_file(): return Err(f"{src_file} is not a file") if src_file.stat().st_size > 5 * 1024 * 1024 * 1024: - return Err("File size exceeds 5GB limit for single put_object operation") + return Err(f"{src_file} is larger than the limit (5GiB) for a single PutObject operation.") config = Config(retries=dict(total_max_attempts=total_max_attempts, mode="adaptive"))