From eb7ceb4dcd4cf6bfcbccd17e678ded09385ff243 Mon Sep 17 00:00:00 2001 From: John Watson Date: Wed, 11 Jun 2025 15:40:16 -0700 Subject: [PATCH] kill the startup script if python fails to start (#237) * kill the startup script if python fails to start * Update scripts/startup_app.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- scripts/startup_app.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/startup_app.sh b/scripts/startup_app.sh index 0cec601b..c910f08e 100755 --- a/scripts/startup_app.sh +++ b/scripts/startup_app.sh @@ -77,10 +77,15 @@ source scripts/load_nvm.sh > /dev/null # start Python backend cd llm-service mkdir -p $MLFLOW_RECONCILER_DATA_PATH -uv run fastapi run --reload --host 127.0.0.1 --port 8081 2>&1 & +uv run fastapi run --host 127.0.0.1 --port 8081 2>&1 & +PY_BACKGROUND_PID=$! # wait for the python backend to be ready while ! curl --output /dev/null --silent --fail http://localhost:8081/amp; do + if ! kill -0 "$PY_BACKGROUND_PID" 2>/dev/null; then + echo "Python backend process exited unexpectedly." + exit 1 + fi echo "Waiting for the Python backend to be ready..." sleep 4 done