wait for tgi server to start before starting server

This commit is contained in:
Xi Yan 2024-10-11 18:54:48 -07:00
parent 2da8aa18bf
commit dfa570ca2e

View file

@ -15,11 +15,6 @@ services:
- HF_MODULES_CACHE=/data - HF_MODULES_CACHE=/data
- HF_HUB_CACHE=/data - HF_HUB_CACHE=/data
command: ["--dtype", "bfloat16", "--usage-stats", "on", "--sharded", "false", "--model-id", "meta-llama/Llama-3.1-8B-Instruct", "--port", "5009", "--cuda-memory-fraction", "0.3"] command: ["--dtype", "bfloat16", "--usage-stats", "on", "--sharded", "false", "--model-id", "meta-llama/Llama-3.1-8B-Instruct", "--port", "5009", "--cuda-memory-fraction", "0.3"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5009/health"]
interval: 5s
timeout: 5s
retries: 10
deploy: deploy:
resources: resources:
reservations: reservations:
@ -34,11 +29,15 @@ services:
# reservation. # reservation.
capabilities: [gpu] capabilities: [gpu]
runtime: nvidia runtime: nvidia
healthcheck:
test: ["CMD", "curl", "-f", "http://text-generation-inference:5009/health"]
interval: 5s
timeout: 5s
retries: 30
llamastack-local-cpu: llamastack-local-cpu:
depends_on: depends_on:
text-generation-inference: text-generation-inference:
condition: service_healthy condition: service_healthy
restart: on-failure
image: llamastack-local-cpu image: llamastack-local-cpu
network_mode: "host" network_mode: "host"
volumes: volumes:
@ -47,9 +46,10 @@ services:
- ./tgi-run.yaml:/root/llamastack-run-tgi.yaml - ./tgi-run.yaml:/root/llamastack-run-tgi.yaml
ports: ports:
- "5000:5000" - "5000:5000"
command: ["--yaml_config", "/root/llamastack-run-tgi.yaml"] # Hack: wait for TGI server to start before starting docker
healthcheck: entrypoint: bash -c "sleep 60; python -m llama_stack.distribution.server.server --yaml_config /root/llamastack-run-tgi.yaml"
test: ["CMD", "curl", "-f", "http://localhost:5009/health"] restart_policy:
interval: 5s condition: on-failure
timeout: 5s delay: 3s
retries: 10 max_attempts: 5
window: 60s