File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44import grpc
55from google .protobuf .empty_pb2 import Empty
6+ from grpc_health .v1 import health , health_pb2 , health_pb2_grpc
7+ from grpc_reflection .v1alpha import reflection
68
79from feast import FeatureStore
810from feast .data_source import DataSource
@@ -353,6 +355,18 @@ def start_server(store: FeatureStore, port: int):
353355 RegistryServer_pb2_grpc .add_RegistryServerServicer_to_server (
354356 RegistryServer (store .registry ), server
355357 )
358+ # Add health check service to server
359+ health_servicer = health .HealthServicer ()
360+ health_pb2_grpc .add_HealthServicer_to_server (health_servicer , server )
361+ health_servicer .set ("" , health_pb2 .HealthCheckResponse .SERVING )
362+
363+ service_names_available_for_reflection = (
364+ RegistryServer_pb2 .DESCRIPTOR .services_by_name ["RegistryServer" ].full_name ,
365+ health_pb2 .DESCRIPTOR .services_by_name ["Health" ].full_name ,
366+ reflection .SERVICE_NAME ,
367+ )
368+ reflection .enable_server_reflection (service_names_available_for_reflection , server )
369+
356370 server .add_insecure_port (f"[::]:{ port } " )
357371 server .start ()
358372 server .wait_for_termination ()
You can’t perform that action at this time.
0 commit comments