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

fix: added region to S3 #715

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hub/store/s3_file_system_replacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ def get_mapper(self, root: str, check=False, create=False):
root = "s3://" + root
client_kwargs = self._kwargs.get("client_kwargs")
endpoint_url = client_kwargs and client_kwargs.get("endpoint_url") or None
aws_region = client_kwargs and client_kwargs.get("region_name") or None
return S3Storage(
self,
root,
aws_access_key_id=self._kwargs.get("key"),
aws_secret_access_key=self._kwargs.get("secret"),
aws_session_token=self._kwargs.get("token"),
aws_region=aws_region,
endpoint_url=endpoint_url,
)
4 changes: 4 additions & 0 deletions hub/store/s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ def __init__(
aws_session_token=None,
parallel=25,
endpoint_url=None,
aws_region=None,
):
self.s3fs = s3fs
self.root = {}
self.url = url
self.public = public
self.parallel = parallel
self.aws_region = aws_region
self.endpoint_url = endpoint_url
self.bucket = url.split("/")[2]
self.path = "/".join(url.split("/")[3:])
Expand All @@ -54,6 +56,7 @@ def __init__(
aws_session_token=aws_session_token,
config=client_config,
endpoint_url=endpoint_url,
region_name=aws_region,
)

self.resource = boto3.resource(
Expand All @@ -63,6 +66,7 @@ def __init__(
aws_session_token=aws_session_token,
config=client_config,
endpoint_url=endpoint_url,
region_name=aws_region,
)

def __setitem__(self, path, content):
Expand Down