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

Put object options #4219

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Put object options #4219

wants to merge 17 commits into from

Conversation

drernie
Copy link
Member

@drernie drernie commented Nov 18, 2024

Update push et al to take optional arguments to pass to PutObject.

@drernie drernie requested a review from Copilot November 18, 2024 05:01
@drernie drernie self-assigned this Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 38.28%. Comparing base (e7743a7) to head (2d21857).

Files with missing lines Patch % Lines
api/python/quilt3/api.py 50.00% 1 Missing ⚠️
api/python/quilt3/data_transfer.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4219   +/-   ##
=======================================
  Coverage   38.27%   38.28%           
=======================================
  Files         776      776           
  Lines       34323    34328    +5     
  Branches     5424     5424           
=======================================
+ Hits        13137    13141    +4     
- Misses      20007    20008    +1     
  Partials     1179     1179           
Flag Coverage Δ
api-python 91.28% <93.75%> (-0.01%) ⬇️
catalog 16.87% <ø> (ø)
lambda 91.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 suggestions.

Files not reviewed (1)
  • api/python/tests/test_bucket.py: Evaluated as low risk

api/python/quilt3/api.py Outdated Show resolved Hide resolved
api/python/quilt3/packages.py Outdated Show resolved Hide resolved
api/python/quilt3/packages.py Outdated Show resolved Hide resolved
api/python/quilt3/packages.py Outdated Show resolved Hide resolved
api/python/quilt3/packages.py Outdated Show resolved Hide resolved
@drernie drernie marked this pull request as ready for review November 18, 2024 05:40
@drernie drernie requested a review from sir-sigurd November 18, 2024 05:41
@drernie
Copy link
Member Author

drernie commented Nov 18, 2024

@sir-sigurd What else can I check besides that the args get passed to copy_mock?

@drernie drernie enabled auto-merge November 18, 2024 05:41
@drernie drernie requested a review from nl0 November 19, 2024 16:10
Copy link
Member

@nl0 nl0 left a comment

Choose a reason for hiding this comment

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

the general direction seems ok, tho it looks like you forgot to actually use put_options in one place (data_transfer._upload_file).
plus some formatting nitpicks.
also, i can't comment on the completeness of this change (i.e. whether you covered all the places where an object may be written o s3)

api/python/quilt3/data_transfer.py Show resolved Hide resolved
@@ -301,7 +301,7 @@ def _copy_local_file(ctx: WorkerContext, size: int, src_path: str, dest_path: st
ctx.done(PhysicalKey.from_path(dest_path), None)


def _upload_file(ctx: WorkerContext, size: int, src_path: str, dest_bucket: str, dest_key: str):
def _upload_file(ctx: WorkerContext, size: int, src_path: str, dest_bucket: str, dest_key: str, put_options=None):
Copy link
Member

Choose a reason for hiding this comment

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

i don't see where this argument is used.
also, this case is somewhat less straightforward, because there may be (and usually are) operations other than PutObject: create / update MPU, upload part -- what's the plan regarding those?

api/python/tests/integration/test_packages.py Outdated Show resolved Hide resolved
bucket = Bucket('s3://test-bucket')
bucket.put_file(key='README.md', path='./README') # put local file to bucket
bucket.put_file(key='README.md', path='./README', put_options=opts)
# put local file to bucket
Copy link
Member

Choose a reason for hiding this comment

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

the comment should be either above or on the line it refers to

api/python/tests/test_bucket.py Outdated Show resolved Hide resolved
Copy link
Member

@sir-sigurd sir-sigurd left a comment

Choose a reason for hiding this comment

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

  1. let's add type hints for new parameter (and don't specify type in docstring)
  2. use case is not quite clear, instead of specifying options per operation it might be sufficient and more ergonomic to set them globally or other way round use case might need a way to specify options per object

api/python/quilt3/data_transfer.py Show resolved Hide resolved
Co-authored-by: Alexei Mochalov <[email protected]>
@drernie
Copy link
Member Author

drernie commented Nov 21, 2024

NOTE: This is too much for me to digest. Unless someone wants to take it on tomorrow, I'll target it for 12/20.

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