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
Prev Previous commit
Split grpc & http methods in python and sort imports correctly
Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
  • Loading branch information
Tsotne Tabidze committed Apr 27, 2022
commit d6e98a2655e89c6c8a52751cfe907978e7a72b20
11 changes: 2 additions & 9 deletions sdk/python/feast/embedded_go/online_features_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,8 @@ def get_online_features(
resp = record_batch_to_online_response(record_batch)
return OnlineResponse(resp)

def start_server(self, host: str, port: int, server_type: str):
server_type = server_type.lower()
if server_type == "grpc":
self._service.StartGprcServer(host, port)
elif server_type == "http":
# TODO(tsotne): implement go-based http server
raise NotImplementedError("Go-based HTTP server will be implemented soon")
else:
raise ValueError("The server type must be either 'http' or 'grpc'")
def start_grpc_server(self, host: str, port: int):
self._service.StartGprcServer(host, port)


def _to_arrow(value, type_hint: Optional[ValueType]) -> pa.Array:
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,8 +1964,8 @@ def serve(self, host: str, port: int, no_access_log: bool) -> None:
if self.config.go_feature_retrieval:
# Start go server instead of python if the flag is enabled
self._lazy_init_go_server()
# TODO(tsotne) add http/grpc flag in CLI and replace the hardcoded variable
self._go_server.start_server(host, port, "grpc")
# TODO(tsotne) add http/grpc flag in CLI and call appropriate method here depending on that
self._go_server.start_grpc_server(host, port)
else:
# Start the python server if go server isn't enabled
feature_server.start_server(self, host, port, no_access_log)
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/transformation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import sys
from concurrent import futures

import grpc
import pyarrow as pa
from grpc_reflection.v1alpha import reflection

import grpc
from feast.errors import OnDemandFeatureViewNotFoundException
from feast.feature_store import FeatureStore
from feast.protos.feast.serving.TransformationService_pb2 import (
Expand Down