Skip to content

Commit 4259d15

Browse files
zzylolclaude
andcommitted
Fix ingest_wait.sh: null-data handling, Arroyo state detection, longer timeout
Three bugs caused the pipeline to always show as 'not found': 1. data.get('data', []) returns None when Arroyo returns {"data": null} for an empty pipeline list. dict.get() only falls back to the default when the key is absent, not when the value is null. Fixed with (data.get('data') or []). 2. Arroyo signals a running pipeline via state=null + stop='none', not a literal "Running" string. The ingest_wait.sh state check was looking for the wrong value; the correct pattern is already used in asap-tools/run_pipeline.sh. 3. MAX_PIPELINE_WAIT=300s is too short: Arroyo must compile Rust UDFs before the pipeline can start, which takes several minutes in CI. Raised to 600s. Also: normalise hyphens/underscores in the name match so 'asap-demo' matches whether Arroyo stores it as 'asap-demo' or 'asap_demo'; add pipeline list dump on timeout for easier future diagnosis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7070ba7 commit 4259d15

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

‎benchmarks/scripts/ingest_wait.sh‎

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -euo pipefail
88
ARROYO_URL="http://localhost:5115/api/v1/pipelines"
99
QE_URL="http://localhost:8088/api/v1/query"
1010
PIPELINE_NAME="asap-demo"
11-
MAX_PIPELINE_WAIT=300 # seconds
11+
MAX_PIPELINE_WAIT=600 # seconds — Arroyo must compile Rust UDFs; allow extra time
1212
ACCUMULATE_SLEEP=90 # seconds after pipeline is running
1313
SLEEP=5
1414

@@ -19,26 +19,45 @@ while true; do
1919
state=$(curl -sf --max-time 10 "${ARROYO_URL}" 2>/dev/null \
2020
| python3 -c "
2121
import sys, json
22-
data = json.load(sys.stdin)
23-
pipelines = data if isinstance(data, list) else data.get('data', [])
24-
for p in pipelines:
25-
name = p.get('name', '') or p.get('id', '')
26-
if '${PIPELINE_NAME}' in str(name):
27-
print(p.get('state', p.get('status', '')))
28-
break
22+
try:
23+
data = json.load(sys.stdin)
24+
# 'data' key may be null when no pipelines exist; use 'or []' to handle that
25+
pipelines = data if isinstance(data, list) else (data.get('data') or [])
26+
for p in pipelines:
27+
name = str(p.get('name') or p.get('id') or '')
28+
# Normalise hyphens/underscores so 'asap-demo' matches 'asap_demo'
29+
if '${PIPELINE_NAME}'.replace('-', '_') in name.replace('-', '_'):
30+
state = p.get('state')
31+
stop = p.get('stop', '')
32+
# Arroyo signals a running pipeline via state=null and stop='none'
33+
if state is None and stop == 'none':
34+
print('Running')
35+
elif state is not None:
36+
print(str(state))
37+
else:
38+
print('stopped')
39+
break
40+
else:
41+
# No matching pipeline found yet — print nothing so caller retries
42+
pass
43+
except Exception:
44+
pass
2945
" 2>/dev/null || true)
3046

31-
if [ "${state}" = "Running" ] || [ "${state}" = "RUNNING" ]; then
47+
if [ "${state}" = "Running" ] || [ "${state}" = "RUNNING" ] || [ "${state}" = "running" ]; then
3248
echo "[ingest_wait] Pipeline '${PIPELINE_NAME}' is RUNNING (${elapsed}s elapsed)"
3349
break
3450
fi
3551

3652
if [ "${elapsed}" -ge "${MAX_PIPELINE_WAIT}" ]; then
37-
echo "[ingest_wait] ERROR: Pipeline '${PIPELINE_NAME}' did not reach RUNNING within ${MAX_PIPELINE_WAIT}s (last state: '${state}')" >&2
53+
echo "[ingest_wait] ERROR: Pipeline '${PIPELINE_NAME}' did not reach RUNNING within ${MAX_PIPELINE_WAIT}s (last state: '${state:-unknown}')" >&2
54+
# Dump pipeline list for diagnosis
55+
echo "[ingest_wait] Current Arroyo pipeline list:" >&2
56+
curl -sf --max-time 10 "${ARROYO_URL}" 2>/dev/null | python3 -m json.tool 2>/dev/null >&2 || true
3857
exit 1
3958
fi
4059

41-
echo "[ingest_wait] Pipeline state: '${state:-unknown}' — retrying in ${SLEEP}s (${elapsed}s elapsed) ..."
60+
echo "[ingest_wait] Pipeline state: '${state:-not found}' — retrying in ${SLEEP}s (${elapsed}s elapsed) ..."
4261
sleep "${SLEEP}"
4362
elapsed=$(( elapsed + SLEEP ))
4463
done

0 commit comments

Comments
 (0)