Download scripts/test_loopback.sh from Dengliming/StreamPIReal6_3w: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/Dengliming/StreamPIReal6_3w/resolve/main/scripts/test_loopback.sh
- Command line
-
hf download hf://Dengliming/StreamPIReal6_3w/scripts/test_loopback.sh
-
curl -L -o test_loopback.sh https://huggingface.co/Dengliming/StreamPIReal6_3w/resolve/main/scripts/test_loopback.sh
2.2 kB
| set -Eeuo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| if [ -n "${OPENPI_PYTHON:-}" ]; then | |
| PY="$OPENPI_PYTHON" | |
| elif [ -x "$ROOT/.venv/bin/python" ]; then | |
| PY="$ROOT/.venv/bin/python" | |
| else | |
| PY="$(command -v python3 || true)" | |
| fi | |
| if [ -z "$PY" ] || [ ! -x "$PY" ]; then | |
| echo "ERROR: no usable Python interpreter found" | |
| exit 1 | |
| fi | |
| PORT="${LOOPBACK_PORT:-18080}" | |
| GPU="${LOOPBACK_GPU:-0}" | |
| LOG="${LOOPBACK_LOG:-/tmp/streampi_piperx_loopback.log}" | |
| MAX_LATENCY="${LOOPBACK_MAX_LATENCY_SECONDS:-2.0}" | |
| if ss -ltn 2>/dev/null | grep -q ":${PORT} "; then | |
| echo "ERROR: port $PORT is already occupied" | |
| exit 1 | |
| fi | |
| rm -f "$LOG" | |
| cleanup() { | |
| if [ -n "${SERVER_PID:-}" ] && | |
| kill -0 "$SERVER_PID" 2>/dev/null; then | |
| kill "$SERVER_PID" 2>/dev/null || true | |
| wait "$SERVER_PID" 2>/dev/null || true | |
| fi | |
| } | |
| trap cleanup EXIT INT TERM | |
| POLICY_HOST=127.0.0.1 \ | |
| POLICY_PORT="$PORT" \ | |
| POLICY_GPU="$GPU" \ | |
| OPENPI_PYTHON="$PY" \ | |
| "$ROOT/scripts/start_policy_server.sh" \ | |
| >"$LOG" 2>&1 & | |
| SERVER_PID=$! | |
| echo "SERVER_PID=$SERVER_PID" | |
| echo "SERVER_LOG=$LOG" | |
| READY=0 | |
| for attempt in $(seq 1 300); do | |
| if ! kill -0 "$SERVER_PID" 2>/dev/null; then | |
| echo "ERROR: server exited during startup" | |
| tail -160 "$LOG" | |
| exit 1 | |
| fi | |
| if ss -ltn 2>/dev/null | grep -q ":${PORT} "; then | |
| READY=1 | |
| break | |
| fi | |
| if [ $((attempt % 5)) -eq 0 ]; then | |
| echo "[waiting] elapsed=$((attempt * 2))s" | |
| tail -5 "$LOG" || true | |
| fi | |
| sleep 2 | |
| done | |
| if [ "$READY" -ne 1 ]; then | |
| echo "ERROR: server startup timeout" | |
| tail -200 "$LOG" | |
| exit 1 | |
| fi | |
| echo "SERVER_READY" | |
| POLICY_HOST=127.0.0.1 \ | |
| POLICY_PORT="$PORT" \ | |
| OPENPI_CLIENT_PYTHON="$PY" \ | |
| WARMUP_STEPS=3 \ | |
| "$ROOT/scripts/warmup_policy.sh" | |
| echo | |
| echo "===== POST-WARMUP VALIDATION =====" | |
| export PYTHONDONTWRITEBYTECODE=1 | |
| export PYTHONPATH="$ROOT:$ROOT/packages/openpi-client/src" | |
| "$PY" "$ROOT/deployment/smoke_client.py" \ | |
| --host 127.0.0.1 \ | |
| --port "$PORT" \ | |
| --steps 4 \ | |
| --reset-check \ | |
| --max-latency-seconds "$MAX_LATENCY" | |
| echo | |
| echo "===== SERVER LOG TAIL =====" | |
| tail -100 "$LOG" | |
| echo "LOOPBACK_TEST_OK" | |