-
Notifications
You must be signed in to change notification settings - Fork 727
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
Replace awscli v1 with boto3 during environment bootstrapping #1778
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,22 @@ | |
from metaflow.exception import MetaflowException | ||
|
||
|
||
def parse_s3_full_path(s3_uri): | ||
from urllib.parse import urlparse | ||
|
||
# <scheme>://<netloc>/<path>;<params>?<query>#<fragment> | ||
scheme, netloc, path, _, _, _ = urlparse(s3_uri) | ||
assert scheme == "s3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. within metaflow code base, we have elected to not use assert statements. also, when the assert statement fails, the user is left no better in their understanding of how to fix the issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is copied from |
||
assert netloc is not None | ||
|
||
bucket = netloc | ||
path = path.lstrip("/").rstrip("/") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need it for this case, but just keeping this in line with the other |
||
if path == "": | ||
path = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't expect this to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, removing it makes sense for this use case.. I sound like a broken record at this point, but I just copied this wholesale from |
||
|
||
return bucket, path | ||
|
||
|
||
def get_ec2_instance_metadata(): | ||
""" | ||
Fetches the EC2 instance metadata through AWS instance metadata service | ||
|
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.
@trhodeos is there any specific reason to create a utility function? maybe we can have this snippet live right next to L:91 in
metaflow_environment.py
. it will help in making the code much more readable (avoiding an extra jump to a different file)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.
This mirrors what we do for azure and gcs. I was just following convention here, happy to pull this inline if you think it's better.