Skip to content

Commit

Permalink
feat: Add python client for remote registry server (#3941)
Browse files Browse the repository at this point in the history
* add remote registry

Signed-off-by: tokoko <[email protected]>

* format and lint remote registry code

Signed-off-by: tokoko <[email protected]>

* add read-only registry exception

Signed-off-by: tokoko <[email protected]>

---------

Signed-off-by: tokoko <[email protected]>
  • Loading branch information
tokoko authored Mar 7, 2024
1 parent fa8492d commit 42a7b81
Show file tree
Hide file tree
Showing 7 changed files with 454 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sdk/python/feast/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,8 @@ def __init__(self):
class PushSourceNotFoundException(Exception):
def __init__(self, push_source_name: str):
super().__init__(f"Unable to find push source '{push_source_name}'.")


class ReadOnlyRegistryException(Exception):
def __init__(self):
super().__init__("Registry implementation is read-only.")
4 changes: 4 additions & 0 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ def __init__(
self._registry = SnowflakeRegistry(
registry_config, self.config.project, None
)
elif registry_config and registry_config.registry_type == "remote":
from feast.infra.registry.remote import RemoteRegistry

self._registry = RemoteRegistry(registry_config, self.config.project, None)
else:
r = Registry(self.config.project, registry_config, repo_path=self.repo_path)
r._initialize_registry(self.config.project)
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/registry/base_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def delete_feature_view(self, name: str, project: str, commit: bool = True):
@abstractmethod
def get_stream_feature_view(
self, name: str, project: str, allow_cache: bool = False
):
) -> StreamFeatureView:
"""
Retrieves a stream feature view.
Expand Down
4 changes: 4 additions & 0 deletions sdk/python/feast/infra/registry/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ def __new__(
from feast.infra.registry.snowflake import SnowflakeRegistry

return SnowflakeRegistry(registry_config, project, repo_path)
elif registry_config and registry_config.registry_type == "remote":
from feast.infra.registry.remote import RemoteRegistry

return RemoteRegistry(registry_config, project, repo_path)
else:
return super(Registry, cls).__new__(cls)

Expand Down
Loading

0 comments on commit 42a7b81

Please sign in to comment.