Skip to content

Commit d6e98a2

Browse files
author
Tsotne Tabidze
committed
Split grpc & http methods in python and sort imports correctly
Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
1 parent 6026b5f commit d6e98a2

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

sdk/python/feast/embedded_go/online_features_service.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,8 @@ def get_online_features(
132132
resp = record_batch_to_online_response(record_batch)
133133
return OnlineResponse(resp)
134134

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

145138

146139
def _to_arrow(value, type_hint: Optional[ValueType]) -> pa.Array:

sdk/python/feast/feature_store.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1964,8 +1964,8 @@ def serve(self, host: str, port: int, no_access_log: bool) -> None:
19641964
if self.config.go_feature_retrieval:
19651965
# Start go server instead of python if the flag is enabled
19661966
self._lazy_init_go_server()
1967-
# TODO(tsotne) add http/grpc flag in CLI and replace the hardcoded variable
1968-
self._go_server.start_server(host, port, "grpc")
1967+
# TODO(tsotne) add http/grpc flag in CLI and call appropriate method here depending on that
1968+
self._go_server.start_grpc_server(host, port)
19691969
else:
19701970
# Start the python server if go server isn't enabled
19711971
feature_server.start_server(self, host, port, no_access_log)

sdk/python/feast/transformation_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import sys
33
from concurrent import futures
44

5+
import grpc
56
import pyarrow as pa
67
from grpc_reflection.v1alpha import reflection
78

8-
import grpc
99
from feast.errors import OnDemandFeatureViewNotFoundException
1010
from feast.feature_store import FeatureStore
1111
from feast.protos.feast.serving.TransformationService_pb2 import (

0 commit comments

Comments
 (0)