feat(cheap-worker): bake-off 加 --offset 支持补跑不覆盖既有批(M1 U3)

补跑 click-score(确认满批 5/7 是否抖动)需 gid 从 offset 起、不覆盖 bake-<key>-0..6;
run_bakeoff 加 offset 参数,gid=bake-<key>-<offset+k>。单测 11/11 仍绿。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lili 2026-06-27 07:00:01 -07:00
parent 0d582b2956
commit 452d2f2642

View File

@ -97,7 +97,7 @@ def run_one_sync(genre_key: str, brief: str, k: int, port: int, cdp: int) -> dic
"failedGates": (v or {}).get("failedGates"), "costRmb": summary.get("costRmb")}
async def run_bakeoff(genre_keys: list, n: int, conc: int = 1,
async def run_bakeoff(genre_keys: list, n: int, conc: int = 1, offset: int = 0,
base_port: int = 4320, base_cdp: int = 9222) -> dict:
"""三品类 × n 达标批跑:逐款 run_studio(自动 spec 九门),按品类聚合 ≥80%。
@ -128,7 +128,7 @@ async def run_bakeoff(genre_keys: list, n: int, conc: int = 1,
port, cdp = await pool.get()
try:
print(f"[{key} {k + 1}/{n}] port={port}/{cdp} 生成→自动spec→九门 …", file=sys.stderr)
r = await asyncio.to_thread(run_one_sync, key, brief, k, port, cdp)
r = await asyncio.to_thread(run_one_sync, key, brief, offset + k, port, cdp)
genre_runs[key].append(r)
print(f"[{key} {k + 1}/{n}] passed={r['passed']} finished={r['finished']} cost={r['costRmb']}",
file=sys.stderr)
@ -170,8 +170,9 @@ if __name__ == "__main__":
help="逗号分隔品类键(默认三 tap-targets 代表品类)")
ap.add_argument("--n", type=int, default=7, help="每品类款数(20 款收口约每品类 7;小批联调用 1–2)")
ap.add_argument("--conc", type=int, default=1, help="并发款数(端口池+线程,≤15;本机 Chrome 建议 ≤4)")
ap.add_argument("--offset", type=int, default=0, help="gameId 起始索引(补跑用,避免覆盖既有 bake-<key>-<k>)")
a = ap.parse_args()
keys = [k.strip() for k in a.genres.split(",") if k.strip()]
rep = asyncio.run(run_bakeoff(keys, a.n, conc=a.conc))
rep = asyncio.run(run_bakeoff(keys, a.n, conc=a.conc, offset=a.offset))
# 退出码:整体达标 0、未达标 1。
sys.exit(0 if rep["overallMeets"] else 1)