Files

24 lines
949 B
Python
Raw Permalink Normal View History

"""Fast deterministic example; no model service or GPU access."""
import argparse
import json
import os
from pathlib import Path
import sys
import time
parser = argparse.ArgumentParser()
parser.add_argument("--scenario", choices=["success", "failure", "wait"], default="success")
args = parser.parse_args()
root = Path(os.environ["XAS_RUN_DIR"])
print("开始快速流程验收(模拟数据),不调用模型。", flush=True)
for index in range(3):
print(f"步骤 {index + 1}/3:日志输出正常", flush=True)
time.sleep(0.3)
if args.scenario == "wait":
print("等待取消或超时。", flush=True)
time.sleep(120)
report = {"synthetic": True, "scenario": args.scenario, "success": args.scenario == "success", "checks": 3}
(root / "result.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
print("结果已写入 result.json", flush=True)
sys.exit(0 if args.scenario == "success" else 2)