34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# L99 On-Demand Runner — videos + screenshots + analysis
|
|
# Usage: bash l99-ondemand.sh [full|quick|visual]
|
|
MODE=${1:-quick}
|
|
LOG=/var/log/wevia-l99-ondemand.log
|
|
BD=/opt/weval-l99
|
|
|
|
echo "$(date): L99 ON-DEMAND ($MODE) START" >> $LOG
|
|
|
|
# Purge old media >3 days
|
|
find $BD/screenshots -name "*.png" -mtime +3 -delete 2>/dev/null
|
|
find $BD/videos -name "*.webm" -mtime +3 -delete 2>/dev/null
|
|
|
|
# Run L99 master
|
|
if [ "$MODE" = "full" ]; then
|
|
timeout 300 python3 $BD/l99-master.py >> $LOG 2>&1
|
|
elif [ "$MODE" = "visual" ]; then
|
|
timeout 120 python3 $BD/l99-alive.py >> $LOG 2>&1
|
|
else
|
|
timeout 120 python3 $BD/l99-master.py --quick >> $LOG 2>&1
|
|
fi
|
|
|
|
# Count results
|
|
PASS=$(python3 -c "import json;d=json.load(open('$BD/logs/$(ls -t $BD/logs/l99-*.json 2>/dev/null | head -1 | xargs basename)'));print(d.get('pass',0))" 2>/dev/null)
|
|
FAIL=$(python3 -c "import json;d=json.load(open('$BD/logs/$(ls -t $BD/logs/l99-*.json 2>/dev/null | head -1 | xargs basename)'));print(d.get('fail',0))" 2>/dev/null)
|
|
SCREENS=$(ls $BD/screenshots/*.png 2>/dev/null | wc -l)
|
|
VIDS=$(ls $BD/videos/*.webm 2>/dev/null | wc -l)
|
|
|
|
echo "$(date): L99 DONE pass:$PASS fail:$FAIL screens:$SCREENS videos:$VIDS" >> $LOG
|
|
|
|
# Copy latest results to API
|
|
LATEST=$(ls -t $BD/logs/l99-*.json 2>/dev/null | head -1)
|
|
[ -n "$LATEST" ] && cp "$LATEST" /var/www/html/api/l99-results.json
|