-
Notifications
You must be signed in to change notification settings - Fork 90
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
Register event callback #4281
base: master
Are you sure you want to change the base?
Register event callback #4281
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4281 +/- ##
==========================================
+ Coverage 38.59% 39.06% +0.46%
==========================================
Files 778 780 +2
Lines 34394 34691 +297
Branches 5430 5225 -205
==========================================
+ Hits 13276 13552 +276
- Misses 19939 20596 +657
+ Partials 1179 543 -636
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
@sir-sigurd @nl0 The basic idea is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
api/python/quilt3/data_transfer.py:182
- The new method
add_options_safely
introduces new behavior that should be covered by tests.
def add_options_safely(params: dict, options: Optional[dict]):
api/python/quilt3/data_transfer.py:193
- The new method
register_event_callback
introduces new behavior that should be covered by tests.
def register_event_callback(self, event_name: str, callback: Optional[Callable]) -> None:
api/python/quilt3/data_transfer.py:209
- The new method
register_write_options
introduces new behavior that should be covered by tests.
def register_write_options(self, **kwargs):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it needs some user facing API and I guess event handlers should be stored globally instead of storing them on S3ClientProvider instance which we create almost on every call of data_transfer
functions
I don't have strong opinion on that but it might make sense to allow users to provide some hook for client creation instead
it looks like we had some users modifying client creation (see #1941 (comment)) and we had attempt to allow user-provided clients (see #3765)
Co-authored-by: Sergey Fedoseev <[email protected]>
By globally do you mean as a class property? I forget the proper idiom for Python. |
There was a problem hiding this 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 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
api/python/quilt3/data_transfer.py:98
- [nitpick] The error message should be more descriptive. Suggestion: 'Cannot override existing key
{key}
in params with options: {options}. Please ensure that the options do not conflict with existing params.'
raise ValueError(f"Cannot override key `{key}` using options: {options}.")
api/python/quilt3/data_transfer.py:125
- The docstring example in
register_event_options
is missing a closing backtick for the code block.
</details>
@sir-sigurd @nl0 Okay, I think this basically works.
|
I think you could patch something to make it create stubbed client (maybe using
it doesn't look like a best way to expose it, maybe have that registration function separate from S3ClientProvider, maybe even add a separate submodule for that? 🤔 |
…a/quilt into register_event_callback
@sir-sigurd I think I've done all I can (can you do the gendocs?). Can you talk with @nl0 and finalize whether this is the right direction, and what else needs to be done / tested? |
Description
Strawman proposal for how to use boto3 events to solve the problem of "include appropriate parameters when writing S3 objects"
TODO