Skip to content

Commit

Permalink
feat: Add ability to give boto extra args for registry config (#3219)
Browse files Browse the repository at this point in the history
* feature: add ability to give boto extra args in config

Signed-off-by: Max Z <max.zwiessele@babylonhealth.com>

* rename: s3_additional_kwargs

Signed-off-by: Max Z <max.zwiessele@babylonhealth.com>

Signed-off-by: Max Z <max.zwiessele@babylonhealth.com>
  • Loading branch information
mzwiessele authored Sep 20, 2022
1 parent f020630 commit fbc6a2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sdk/python/feast/infra/registry/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, registry_config: RegistryConfig, repo_path: Path):
self._uri = urlparse(uri)
self._bucket = self._uri.hostname
self._key = self._uri.path.lstrip("/")
self._boto_extra_args = registry_config.s3_additional_kwargs or {}

self.s3_client = boto3.resource(
"s3", endpoint_url=os.environ.get("FEAST_S3_ENDPOINT_URL")
Expand Down Expand Up @@ -77,4 +78,6 @@ def _write_registry(self, registry_proto: RegistryProto):
file_obj = TemporaryFile()
file_obj.write(registry_proto.SerializeToString())
file_obj.seek(0)
self.s3_client.Bucket(self._bucket).put_object(Body=file_obj, Key=self._key)
self.s3_client.Bucket(self._bucket).put_object(
Body=file_obj, Key=self._key, **self._boto_extra_args
)
3 changes: 3 additions & 0 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class RegistryConfig(FeastBaseModel):
set to infinity by setting TTL to 0 seconds, which means the cache will only be loaded once and will never
expire. Users can manually refresh the cache by calling feature_store.refresh_registry() """

s3_additional_kwargs: Optional[Dict[str, str]]
""" Dict[str, str]: Extra arguments to pass to boto3 when writing the registry file to S3. """


class RepoConfig(FeastBaseModel):
"""Repo config. Typically loaded from `feature_store.yaml`"""
Expand Down

0 comments on commit fbc6a2c

Please sign in to comment.