Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Allow local feature server to use Go feature server if enabled
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 committed Apr 13, 2022
commit 5bc7136b3889f9fb291f59f27258dba83092de61
4 changes: 2 additions & 2 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def get_online_features(body=Depends(get_body)):
raise HTTPException(status_code=500, detail="Uneven number of columns")

response_proto = store._get_online_features(
features,
request_proto.entities,
features=features,
entity_values=request_proto.entities,
full_feature_names=full_feature_names,
native_entity_values=False,
).proto
Expand Down
36 changes: 18 additions & 18 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,23 @@ def get_online_features(
except KeyError as e:
raise ValueError("All entity_rows must have the same keys.") from e

# If Go feature server is enabled, send request to it instead of going through a regular Python logic
return self._get_online_features(
features=features,
entity_values=columnar,
full_feature_names=full_feature_names,
native_entity_values=True,
)

def _get_online_features(
self,
features: Union[List[str], FeatureService],
entity_values: Mapping[
str, Union[Sequence[Any], Sequence[Value], RepeatedValue]
],
full_feature_names: bool = False,
native_entity_values: bool = True,
):
# If Go feature server is enabled, send request to it instead of going through regular Python logic
if self.config.go_feature_server:
from feast.embedded_go.online_features_service import (
EmbeddedOnlineFeatureServer,
Expand All @@ -1301,27 +1317,11 @@ def get_online_features(
feature_service=features
if isinstance(features, FeatureService)
else None,
entities=columnar,
entities=entity_values,
request_data={}, # TODO: add request data parameter to public API
full_feature_names=full_feature_names,
)

return self._get_online_features(
features=features,
entity_values=columnar,
full_feature_names=full_feature_names,
native_entity_values=True,
)

def _get_online_features(
self,
features: Union[List[str], FeatureService],
entity_values: Mapping[
str, Union[Sequence[Any], Sequence[Value], RepeatedValue]
],
full_feature_names: bool = False,
native_entity_values: bool = True,
):
_feature_refs = self._get_features(features, allow_cache=True)
(
requested_feature_views,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
IntegrationTestRepoConfig(
online_store=REDIS_CONFIG, go_feature_server=True,
),
IntegrationTestRepoConfig(
online_store=REDIS_CONFIG,
python_feature_server=True,
go_feature_server=True,
),
]
)
full_repo_configs_module = os.environ.get(FULL_REPO_CONFIGS_MODULE_ENV_NAME)
Expand Down