Skip to content

Commit

Permalink
feat: Add health check service to registry server (feast-dev#4421)
Browse files Browse the repository at this point in the history
Signed-off-by: Bhargav Dodla <[email protected]>
Co-authored-by: Bhargav Dodla <[email protected]>
  • Loading branch information
EXPEbdodla and Bhargav Dodla authored Aug 19, 2024
1 parent d18d01d commit 46655f0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sdk/python/feast/registry_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import grpc
from google.protobuf.empty_pb2 import Empty
from grpc_health.v1 import health, health_pb2, health_pb2_grpc
from grpc_reflection.v1alpha import reflection

from feast import FeatureStore
from feast.data_source import DataSource
Expand Down Expand Up @@ -353,6 +355,18 @@ def start_server(store: FeatureStore, port: int):
RegistryServer_pb2_grpc.add_RegistryServerServicer_to_server(
RegistryServer(store.registry), server
)
# Add health check service to server
health_servicer = health.HealthServicer()
health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)
health_servicer.set("", health_pb2.HealthCheckResponse.SERVING)

service_names_available_for_reflection = (
RegistryServer_pb2.DESCRIPTOR.services_by_name["RegistryServer"].full_name,
health_pb2.DESCRIPTOR.services_by_name["Health"].full_name,
reflection.SERVICE_NAME,
)
reflection.enable_server_reflection(service_names_available_for_reflection, server)

server.add_insecure_port(f"[::]:{port}")
server.start()
server.wait_for_termination()

0 comments on commit 46655f0

Please sign in to comment.