Buckets:
| """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.3 kB
- Xet hash:
- 8588c31bf5e4e31c50304a4cdb3501a4ec650de2297744f99258bec23ba0474a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.