feat(storage): enhance save_file method to accept storage class parameter

This commit is contained in:
Siddhant Rai
2025-07-10 15:34:52 +05:30
parent 839a12bed4
commit 5623734276
3 changed files with 13 additions and 4 deletions

View File

@@ -38,9 +38,17 @@ class S3Storage(BaseStorage):
region_name=region_name,
)
def save_file(self, file_data: BinaryIO, path: str) -> dict:
def save_file(
self,
file_data: BinaryIO,
path: str,
storage_class: str = "INTELLIGENT_TIERING",
**kwargs,
) -> dict:
"""Save a file to S3 storage."""
self.s3.upload_fileobj(file_data, self.bucket_name, path)
self.s3.upload_fileobj(
file_data, self.bucket_name, path, ExtraArgs={"StorageClass": storage_class}
)
region = getattr(settings, "SAGEMAKER_REGION", None)