예제 소스
바둑 on-policy 학습: 대국 로그를 KataGo 라벨로 바꾸기 · 파일 169개
daemon_mariago_web_monitor.py
#!/usr/bin/env python3
"""MariaGO 웹 경로 조기 PASS·불법수 무한 모니터링 대국.
웹과 동일: WS bridge(:9320) → VLM. 휴리스틱(흑) vs VLM(백).
.venv/bin/python scripts/daemon_mariago_web_monitor.py
"""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
PY = str(ROOT / ".venv" / "bin" / "python")
OUT = ROOT / "logs" / "mariago_web_monitor"
def main() -> int:
OUT.mkdir(parents=True, exist_ok=True)
cmd = [
PY,
str(ROOT / "scripts" / "monitor_mariago_web_play.py"),
"--ws-url",
"ws://127.0.0.1:9320",
"--games",
"0", # infinite
"--max-moves",
"150",
"--timeout-s",
"240",
"--sleep-s",
"5",
"--out-dir",
str(OUT),
]
env = os.environ.copy()
env["PYTHONUNBUFFERED"] = "1"
# 워치독이 이 프로세스를 감시하므로 exec 대신 자식으로 둘 수도 있으나
# 단순화를 위해 동일 프로세스로 교체
os.execve(PY, cmd, env)
return 0
if __name__ == "__main__":
raise SystemExit(main())