-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathrun_longmemeval_watch.sh
More file actions
executable file
·89 lines (75 loc) · 2.36 KB
/
Copy pathrun_longmemeval_watch.sh
File metadata and controls
executable file
·89 lines (75 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
#
# Run LongMemEval with persistent logging and local crash/completion notifications.
#
# Usage:
# scripts/run_longmemeval_watch.sh
# scripts/run_longmemeval_watch.sh --max-questions 50
# LONGMEMEVAL_CONFIG=per-turn scripts/run_longmemeval_watch.sh
#
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"
if [[ -f "venv/bin/activate" ]]; then
# Use project virtualenv so benchmark deps (requests/openai/etc.) are available.
# shellcheck disable=SC1091
source "venv/bin/activate"
fi
TIMESTAMP="$(date +%Y%m%d_%H%M%S)"
CONFIG="${LONGMEMEVAL_CONFIG:-baseline}"
OUT_BASE="${LONGMEMEVAL_OUT_BASE:-tests/benchmarks/results/longmemeval_${CONFIG}_${TIMESTAMP}}"
LOG_FILE="${LONGMEMEVAL_LOG_FILE:-${OUT_BASE}.run.log}"
STATUS_FILE="${LONGMEMEVAL_STATUS_FILE:-${OUT_BASE}.status.json}"
mkdir -p "$(dirname "$OUT_BASE")"
notify() {
local title="$1"
local message="$2"
# macOS desktop notification (best effort)
if command -v osascript >/dev/null 2>&1; then
osascript -e "display notification \"${message//\"/\\\"}\" with title \"${title//\"/\\\"}\"" >/dev/null 2>&1 || true
fi
# Terminal bell fallback (interactive terminals only)
if [[ -t 1 ]]; then
printf '\a'
fi
}
echo "Starting LongMemEval watch run"
echo " config: $CONFIG"
echo " out base: $OUT_BASE"
echo " log file: $LOG_FILE"
echo " status file: $STATUS_FILE"
echo
set +e
./test-longmemeval-benchmark.sh --config "$CONFIG" --output "$OUT_BASE" "$@" 2>&1 | tee "$LOG_FILE"
exit_code=${PIPESTATUS[0]}
set -e
status_word="success"
if [[ $exit_code -ne 0 ]]; then
status_word="failed"
fi
cat >"$STATUS_FILE" <<EOF
{
"status": "$status_word",
"exit_code": $exit_code,
"config": "$CONFIG",
"output_base": "$OUT_BASE",
"log_file": "$LOG_FILE",
"finished_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
EOF
if [[ $exit_code -eq 0 ]]; then
notify "LongMemEval Complete" "Run finished successfully. Output: $OUT_BASE.json"
echo
echo "LongMemEval completed successfully."
echo "Results: $OUT_BASE.json"
echo "Hypotheses: $OUT_BASE.jsonl"
echo "Status: $STATUS_FILE"
else
notify "LongMemEval Failed" "Run crashed (exit $exit_code). See: $LOG_FILE"
echo
echo "LongMemEval failed with exit code $exit_code."
echo "See log: $LOG_FILE"
echo "Status: $STATUS_FILE"
fi
exit "$exit_code"