Buckets:
| # 中文源码导读(2026-09-15)|阅读顺序 081|本地工程及扩展 | |
| # 来源:官方同路径无此文件。 | |
| # 作用:核实记录的进程身份后停止本运行,保留实验目录。 | |
| # 对照基准:test-time-training/discover@6c40e82;完整路线见 docs/CODE_READING_ORDER_ZH.md。 | |
| """Signal only the verified launcher; it owns its own cleanup.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| import signal | |
| import psutil | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("run_dir", type=Path) | |
| args = parser.parse_args() | |
| run = args.run_dir.resolve() | |
| record = json.loads((run / "processes.json").read_text()) | |
| try: | |
| proc = psutil.Process(record["launcher"]) | |
| cmd = proc.cmdline() | |
| except psutil.NoSuchProcess: | |
| raise SystemExit("Launcher already exited; no process was signalled") | |
| if "ttt_discover.runtime.launch" not in cmd or "--run-dir" not in cmd: | |
| raise SystemExit("PID no longer belongs to the recorded launcher; refusing to signal") | |
| actual_run = Path(cmd[cmd.index("--run-dir") + 1]) | |
| if not actual_run.is_absolute(): | |
| actual_run = Path(proc.cwd()) / actual_run | |
| if "--probe-resume" in cmd: | |
| actual_run = actual_run / "resume_probe" | |
| if actual_run.resolve() != run: | |
| raise SystemExit("Run path mismatch; refusing to signal") | |
| if record.get("launcher_created") is not None and abs(proc.create_time() - record["launcher_created"]) > 0.01: | |
| raise SystemExit("PID creation time mismatch; refusing to signal") | |
| proc.send_signal(signal.SIGTERM) | |
| print("Stop requested for the verified launcher. Check status and nvidia-smi; checkpoints are retained.") | |
Xet Storage Details
- Size:
- 1.61 kB
- Xet hash:
- c5103e2b705301c4b5b3c99776b06cfef8460d0e95e02028d1bbbc6a3fba6c41
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.