Skip to content

Commit 4511e08

Browse files
committed
fix: Improve error analysis in test_examples.sh to account for notebook reruns
1 parent d655dae commit 4511e08

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

test_examples.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,17 @@ except:
8080
kill $SSE_PID 2>/dev/null
8181
wait $SSE_PID 2>/dev/null
8282

83-
# Analyze results from events
83+
# Analyze final notebook state (accounts for reruns overwriting earlier errors)
8484
CRASHED=$(grep -c '"crashed"' "$EVENTS_FILE" 2>/dev/null || echo 0)
8585
RESULT_COUNT=$(grep -c '"cellResult"' "$EVENTS_FILE" 2>/dev/null || echo 0)
8686

87-
# Extract cell errors from events
88-
CELL_ERRORS=$(grep '"cellResult"' "$EVENTS_FILE" | sed 's/^data: //' | python3 -c "
87+
CELL_ERRORS=$(curl -s --max-time 10 "$BASE/api/notebook" 2>/dev/null | python3 -c "
8988
import sys,json
89+
nb=json.load(sys.stdin)
9090
errors=[]
91-
for line in sys.stdin:
92-
line=line.strip()
93-
if not line: continue
94-
try:
95-
ev=json.loads(line)
96-
if ev.get('error'):
97-
errors.append(f'cell {ev[\"cellId\"]}: {ev[\"error\"][:120]}')
98-
except: pass
91+
for c in nb['nbCells']:
92+
if c['cellType']=='CodeCell' and c.get('cellError'):
93+
errors.append(f'cell {c[\"cellId\"]}: {c[\"cellError\"][:120]}')
9994
for e in errors:
10095
print(e)
10196
" 2>/dev/null)

0 commit comments

Comments
 (0)