Spaces:
Sleeping
Sleeping
Download entrypoint.sh from vespa-engine/hnsw-tuner: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/vespa-engine/hnsw-tuner/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/vespa-engine/hnsw-tuner/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/vespa-engine/hnsw-tuner/resolve/main/entrypoint.sh
1.32 kB
| # Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | |
| set -euo pipefail | |
| cd /app | |
| VESPA_PID="" | |
| APP_PID="" | |
| export VESPA_CONFIGSERVERS="${VESPA_CONFIGSERVERS:-$(hostname)}" | |
| shutdown() { | |
| if [[ -n "$APP_PID" ]] && kill -0 "$APP_PID" 2>/dev/null; then | |
| kill "$APP_PID" 2>/dev/null || true | |
| fi | |
| if [[ -n "$VESPA_PID" ]] && kill -0 "$VESPA_PID" 2>/dev/null; then | |
| kill "$VESPA_PID" 2>/dev/null || true | |
| fi | |
| if [[ -n "$APP_PID" ]]; then | |
| wait "$APP_PID" 2>/dev/null || true | |
| fi | |
| if [[ -n "$VESPA_PID" ]]; then | |
| wait "$VESPA_PID" 2>/dev/null || true | |
| fi | |
| } | |
| trap 'shutdown; exit 1' TERM INT | |
| /usr/local/bin/start-container.sh configserver,services & | |
| VESPA_PID=$! | |
| until curl -sf http://localhost:19071/state/v1/health >/dev/null 2>&1; do | |
| if ! kill -0 "$VESPA_PID" 2>/dev/null; then | |
| set +e | |
| wait "$VESPA_PID" | |
| exit_code=$? | |
| set -e | |
| exit "$exit_code" | |
| fi | |
| sleep 2 | |
| done | |
| export VESPA_URL=http://localhost | |
| export VESPA_PORT=8080 | |
| export PORT=7860 | |
| export DATA_DIR="${DATA_DIR:-/data}" | |
| export DATASET_SIZE="${DATASET_SIZE:-mid}" | |
| /opt/venv/bin/python app.py & | |
| APP_PID=$! | |
| set +e | |
| wait -n "$VESPA_PID" "$APP_PID" | |
| exit_code=$? | |
| set -e | |
| shutdown | |
| exit "$exit_code" | |