Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix silent failure in uploadExportFilesToS3 #176

Merged
merged 4 commits into from
Mar 29, 2025
Merged

Fix silent failure in uploadExportFilesToS3 #176

merged 4 commits into from
Mar 29, 2025

Conversation

Cole-Greer
Copy link
Collaborator

@Cole-Greer Cole-Greer commented Mar 26, 2025

Issue #, if available: N/A

Description of changes:

The recent (currently unreleased) upgrade to AWS SDK v2 introduced a silent failure in the upload of export files to S3. With the new S3 API, there is very little customization that can be done directly on an UploadDirectoryRequest.Builder, instead, many configurations such as adding tags must be done via an UploadFileRequestTransformer, which allows for mutation of the individual file upload requests which ultimately get generated.

The bug here is that by attempting to directly update putObjectRequest() on the UploadFileRequest.Builder, the effect is to null all existing non-overridden parameters in the PutObjectRequest. This includes essential parameters such as bucket and key. The end result is an upload which is guaranteed to fail. The solution here is to clone the original PutObjectRequest and create a new builder from it, which then allows customization of the necessary parameters and attachment back to the original UploadFileRequest builder.

The original code here used to fail silently as a DirectoryUpload will not fail exceptionally if one or more (or all) underlying FileUploadRequests fail. The individual file upload failures were buried inside the DirectoryUpload and there was no indication of any issue other than the files ultimately being missing in S3. This PR also includes a change to log an error for each failed file upload to give proper visibility.

Testing:

Verified successful file upload and correct tagging for all code paths which upload files to S3 (Full directory upload, completion file upload, training config file upload for both V1 and V2 ML profiles, and GcLogFile for failed exports).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@andreachild
Copy link

Changelog entry?

@Cole-Greer
Copy link
Collaborator Author

Changelog entry?

This is a bug-fix for an unreleased change. Changelog is omitted as the change has no relevance when comparing to v1.1.11.

Copy link

@kmcginnes kmcginnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andreachild
Copy link

LGTM

@Cole-Greer Cole-Greer merged commit a6cead4 into develop Mar 29, 2025
4 checks passed
@Cole-Greer Cole-Greer deleted the s3Uploads branch March 31, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants