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

[v2] Add support for stdin/stdout streams for CRT client #8291

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

kyleknap
Copy link
Contributor

@kyleknap kyleknap commented Nov 2, 2023

This PR pulls in changes from this s3transfer PR: boto/s3transfer#277. However, it only pulls in a subset of changes proposed specific to streaming support. The other proposed changes from the s3transfer PR will be considered/pulled in via subsequent PRs. This PR currently targets a feature branch that will consist of all CRT transfer client improvements that we are looking to make, and this branch will eventually be merged into the v2 branch. Once merged, the improvements to the s3transfer code will be backported to the upstream s3transfer project.

In supporting steams at the s3transfer CRT layer, I also did the following refactorings:

  • Refactoring the s3transfer crt layer to better organize the branching introduced in supporting both file objects and file name.
  • Introduce additional helper test methods to reduce verbosity of s3transfer crt test and improve reusability. Even with the updates, there was a fair amount of duplication. In the long term, I'd prefer we switch these over to pytest parameterization, but I suspect that would be larger than the intended scope of this PR.

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (580ceb0) 93.14% compared to head (e50b101) 93.15%.

Additional details and impacted files
@@            Coverage Diff             @@
##           v2-s3-crt    #8291   +/-   ##
==========================================
  Coverage      93.14%   93.15%           
==========================================
  Files            364      364           
  Lines          38482    38497   +15     
  Branches        6167     6167           
==========================================
+ Hits           35845    35862   +17     
+ Misses          1964     1962    -2     
  Partials         673      673           
Files Coverage Δ
awscli/customizations/s3/factory.py 96.10% <ø> (-0.10%) ⬇️
awscli/s3transfer/crt.py 88.79% <100.00%> (+1.78%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

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

One minor comment but otherwise I think this looks good. Feel free to merge if you disagree.

Comment on lines 570 to 581
return getattr(
self,
f'_get_make_request_args_{request_type}',
self._default_get_make_request_args,
)(
request_type=request_type,
call_args=call_args,
coordinator=coordinator,
future=future,
on_done_before_calls=[],
on_done_after_calls=on_done_after_calls,
Copy link
Member

Choose a reason for hiding this comment

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

nit; this seems auto-magic enough to be difficult to debug if we have a failure in getattr or the function call itself since they'll all be on the same line. It may be worth splitting this into a variable for the function and then its invocation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's reasonable. I'll break it up.

Copy link

@graebm graebm left a comment

Choose a reason for hiding this comment

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

LGTM

# Suppress botocore's automatic MD5 calculation by setting an override
# value that will get deleted in the BotocoreCRTRequestSerializer.
# The CRT S3 client will automatically compute checksums as part of
# requests it makes.
Copy link

Choose a reason for hiding this comment

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

CRT S3 Client doesn't compute checksums unless you pass an S3ChecksumConfig. See me setting the checksum algorithm and location here

So this (and the currently released versions) aren't doing any checksums or MD5 for uploads

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. Yeah one of the follow ups is to automatically set checksums for these requests as you had it in your original PR. For now, I'll just delete/update the second sentence in that comment.

This also included:

* Refactoring the s3transfer crt layer to better organize
  the branching introduced in supporting both file objects
  and file name.
* Introduce additional helper test methods to reduce verbosity
  of s3transfer crt test and improve reusability.
@kyleknap kyleknap merged commit 664c330 into aws:v2-s3-crt Nov 2, 2023
24 checks passed
@kyleknap kyleknap deleted the v2-crt-nonseekable branch November 2, 2023 22:17
kyleknap added a commit to kyleknap/s3transfer that referenced this pull request Nov 2, 2023
kyleknap added a commit that referenced this pull request Nov 9, 2023
[v2] Add support for stdin/stdout streams for CRT client
kyleknap added a commit that referenced this pull request Nov 13, 2023
[v2] Add support for stdin/stdout streams for CRT client
kyleknap added a commit to kyleknap/aws-cli that referenced this pull request Nov 22, 2023
[v2] Add support for stdin/stdout streams for CRT client
kyleknap added a commit that referenced this pull request Nov 22, 2023
[v2] Add support for stdin/stdout streams for CRT client
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.

None yet

4 participants