#!/usr/bin/env python3 # -*- coding: utf-8 -*- """作业 7 · 步骤 5:模拟 OOM(不真打爆显存,写 simulate 标记)。""" from __future__ import annotations import sys import _bootstrap # noqa: F401 from 作业7_self_heal import detect_vllm_anomaly, set_simulate_oom def main() -> int: flag = set_simulate_oom(True, "CUDA out of memory: simulated for homework7") print("simulate_oom", flag) got = detect_vllm_anomaly() print("detect", got) if not got.get("anomaly"): print("[FAIL] 模拟 OOM 未被 detect 识别") return 1 print("[OK] 已模拟 OOM,下一步运行 作业7_06_对话验收.py") return 0 if __name__ == "__main__": sys.exit(main())