Skip to content

Commit

Permalink
Add grpc health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajhai committed Nov 10, 2023
1 parent c12ad79 commit 84bf488
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llmstack/common/runner/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import redis
from grpc import ServicerContext
from grpc import server as grpc_server
from grpc_health.v1 import health, health_pb2, health_pb2_grpc
from playwright._impl._api_types import TimeoutError
from playwright.async_api import async_playwright

Expand Down Expand Up @@ -328,6 +329,14 @@ def main():
runner.wss_secure = args.wss_secure

add_RunnerServicer_to_server(runner, server)

# Add health checking service
health_servicer = health.HealthServicer()
health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)

# Set the health status to SERVING
health_servicer.set('', health_pb2.HealthCheckResponse.SERVING)

server.add_insecure_port(f'[::]:{args.port}')
server.start()

Expand Down
4 changes: 4 additions & 0 deletions runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ RUN apt-get update && apt-get install -y \

RUN pip3 install poetry

# Install grpc_health_probe
RUN wget -qO/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.22/grpc_health_probe-linux-amd64 && \
chmod +x /grpc_health_probe

RUN mkdir /code
WORKDIR /code

Expand Down

0 comments on commit 84bf488

Please sign in to comment.