-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
migrate prefect_aws.s3
async tasks to async_dispatch
#16096
Conversation
6fa4f6b
to
42ac696
Compare
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.
Couple of nits on docstring examples. Also, it'd be good to have some tests covering the new async functions and methods.
prefect_aws.s3
async tasks to async_dispatch
pt1prefect_aws.s3
async tasks to async_dispatch
updated the docstrings and added some coverage for the new async tasks |
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.
Nice! I added a note for each of the new/changed methods so that future SDK docs will reflect when a method was added/changed.
I assume a minor version bump is coming, but please change the versions noted if not.
key: Optional[str] = None, | ||
) -> str: | ||
""" | ||
Uploads data to an S3 bucket. |
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.
Uploads data to an S3 bucket. | |
Uploads data to an S3 bucket. Added in version 0.5.3. |
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.
@discdiver do you think we should have a minor version bump because of the new async versions of tasks?
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.
I'd vote for it.
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.
We reserve minor version bumps in integration packages for breaking changes, so we should not release a new minor version for these changes.
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.
Cool. Then just 0.5.3 for each note. I can edit the suggestions.
aws_client_parameters: AwsClientParameters = AwsClientParameters(), | ||
) -> bytes: | ||
""" | ||
Downloads an object with a given key from a given S3 bucket. |
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.
Downloads an object with a given key from a given S3 bucket. | |
Downloads an object with a given key from a given S3 bucket. | |
Added in version 0.5.3. |
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.
Or whichever is the next version if not a minor bump.
the credentials must have permission to read and delete the source object and write | ||
to the target object. If the credentials do not have those permissions, this method | ||
will raise an error. If the credentials have permission to read the source object | ||
but not delete it, the object will be copied but not deleted. |
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.
but not delete it, the object will be copied but not deleted. | |
but not delete it, the object will be copied but not deleted. | |
Added in version 0.5.3. |
|
||
def _list_objects_sync(page_iterator: PageIterator): | ||
""" | ||
Synchronous method to collect S3 objects into a list |
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.
Synchronous method to collect S3 objects into a list | |
Synchronous method to collect S3 objects into a list. | |
Added in version 0.5.3. |
self, | ||
from_folder: str, | ||
to_folder: Optional[Union[str, Path]] = None, | ||
**download_kwargs: Dict[str, Any], | ||
) -> Path: | ||
""" | ||
Downloads objects *within* a folder (excluding the folder itself) | ||
Asynchronously downloads objects *within* a folder (excluding the folder itself) | ||
from the S3 bucket to a folder. |
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.
from the S3 bucket to a folder. | |
from the S3 bucket to a folder. Changed in version 0.5.3. |
@discdiver I'm not sure I like the idea of hardcoding versions where things in appeared in docstrings. also, nothing here is "now asynchronous", there are new tasks which are asynchronous, and the sync tasks will work the same cc @desertaxle on the docstring question |
Thanks @zzstoatzz. Removed note on async. The official Python docs use an .rst directive and then the version change note only shows up in the docs and not the inline docstring. I've asked the Mintlify team if they could add a keyword or symbol that did something similar. I can see arguments both ways. It's nice to keep the docstrings uncluttered. And the note feels pretty small and could be helpful in some cases. |
fair point! I think its a fine compromise to have them in there 👍 thank you for adding them! |
Co-authored-by: Jeff Hale <[email protected]>
Co-authored-by: Jeff Hale <[email protected]>
Co-authored-by: Jeff Hale <[email protected]>
Co-authored-by: Jeff Hale <[email protected]>
Co-authored-by: Jeff Hale <[email protected]>
62d0ee8
to
5df582e
Compare
related to #15008
adds explicit async methods to all public tasks and methods in
prefect_aws.s3
and removes use ofsync_compatable
old notes
i intentionally did not do the
S3Bucket
methods here, since there's an open question I want to discuss with @desertaxlequestion
on S3Bucket
is not actually async at all, not even a sending sync stuff to a worker thread
the established pattern would say we do
that seems like it was duplicate a lot for not a very compelling reason
but because stopped supporting async in sync we might need to do this
also renamed tasks in backword compat fashion per this comment