49 lines
2.4 KiB
Bash
Executable File
49 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 一键启动单一板型目标的输入准备 + Agent 首轮采集:
|
||
# scripts/start_run.sh --target s100p --note "P4 batch 1" [--parallel 8]
|
||
# scripts/start_run.sh --target s600 --note "S600 batch 1" [--parallel 8]
|
||
# scripts/start_run.sh --resume --run r… [--parallel 8] 显式续跑,避免多板型时恢复错 run
|
||
# 之后:bench watch(实时看板)· bench status · bench status --fail · bench show <job_id> · bench report
|
||
set -euo pipefail
|
||
HERE="$(cd "$(dirname "$0")/.." && pwd)"; cd "$HERE"; export PATH="$HERE/bin:$PATH"
|
||
NOTE=""; PAR=""; RESUME=0; TARGET="s100p"; RID=""
|
||
while [ $# -gt 0 ]; do case "$1" in
|
||
--note) NOTE="$2"; shift 2;; --parallel) PAR="--parallel $2"; shift 2;;
|
||
--target) TARGET="$2"; shift 2;; --run) RID="$2"; shift 2;; --resume) RESUME=1; shift;;
|
||
*) echo "unknown arg $1"; exit 2;; esac; done
|
||
if [ "$RESUME" = 1 ]; then
|
||
[ -n "$RID" ] || { echo "--resume 必须同时指定 --run,避免恢复错板型"; exit 2; }
|
||
TARGET=$(python3 - "$RID" <<'PY'
|
||
import json
|
||
import sys
|
||
from harness import db
|
||
with db.readonly() as con:
|
||
run = db.get_run(con, sys.argv[1])
|
||
if not run:
|
||
raise SystemExit(f"run 不存在: {sys.argv[1]}")
|
||
print((json.loads(run["manifest"]).get("target") or {}).get("board_type") or "legacy")
|
||
PY
|
||
)
|
||
bench reset-stale --run "$RID" || true
|
||
else
|
||
[ -z "$RID" ] || { echo "--run 只和 --resume 一起使用"; exit 2; }
|
||
MARCH=$(python3 - "$TARGET" <<'PY'
|
||
import sys
|
||
from harness.registry import target_spec
|
||
print(target_spec(sys.argv[1])["march"])
|
||
PY
|
||
)
|
||
bench preflight --modes oracle,e2e --target "$TARGET" || { echo "preflight 有 ERROR,先修"; exit 1; }
|
||
RID=$(bench new-run --target "$TARGET" --note "${NOTE:-start_run $TARGET $(date +%F)}")
|
||
bench expand --run "$RID" --modes oracle,e2e --marches "$MARCH"
|
||
fi
|
||
LOG="state/run-$RID.log"
|
||
setsid nohup bench run --run "$RID" $PAR >> "$LOG" 2>&1 < /dev/null & disown
|
||
echo "run $RID 已在后台启动(pid $!;target=$TARGET)"
|
||
setsid nohup bench collect --run "$RID" --modes e2e --coverage all --first-pass --watch >> "state/collect-$RID.log" 2>&1 < /dev/null & disown
|
||
echo "Agent 首轮采集已启动(pid $!):state/collect-$RID.log"
|
||
echo " 实时看板: bench watch --run $RID"
|
||
echo " 调度日志: tail -f $LOG"
|
||
echo " 一眼汇总: bench status --run $RID ;失败清单 bench status --fail"
|
||
echo " 静态报告: bench report --run $RID → reports/$RID.html"
|