dgx-harness-engineering / scripts /04_print_decision_summary.py
koreallmdev's picture
Upload anonymized DGX harness engineering export V1.4 (part 2)
fbc9e3f verified
Raw History Blame Contribute Delete
2.47 kB
import argparse
import json
from pathlib import Path
def latest(pattern):
files = sorted(Path(".").glob(pattern), key=lambda p: p.stat().st_mtime, reverse=True)
return files[0] if files else None
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--latest", action="store_true")
args = ap.parse_args()
failed_json = latest("reports/failed_items_*.json")
repair_jsonl = latest("data/repair_dataset_from_failed_items_*.jsonl")
bench_json = latest("reports/bench_14b_champion*.json")
print("==== DECISION SUMMARY ====")
if bench_json:
obj = json.loads(bench_json.read_text(encoding="utf-8"))
print("LATEST_BENCH:", bench_json)
print("SUMMARY:", json.dumps(obj.get("summary", {}), ensure_ascii=False))
else:
print("LATEST_BENCH: not found")
print()
if failed_json:
obj = json.loads(failed_json.read_text(encoding="utf-8"))
n = obj.get("num_failed_or_issued", 0)
print("FAILED_JSON:", failed_json)
print("FAILED_COUNT:", n)
print("CATEGORY_COUNTS:", json.dumps(obj.get("category_counts", {}), ensure_ascii=False))
print("ISSUE_COUNTS:", json.dumps(obj.get("issue_counts", {}), ensure_ascii=False))
print()
issue_counts = obj.get("issue_counts", {})
if n == 0:
print("RECOMMENDATION: ์‹คํŒจ ํ•ญ๋ชฉ์ด ์—†์œผ๋ฏ€๋กœ ์žฌํ•™์Šตํ•˜์ง€ ๋ง๊ณ  ํ˜„์žฌ ๋ชจ๋ธ์„ ์œ ์ง€ํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค.")
elif any("possible_chinese_leakage" in k for k in issue_counts):
print("RECOMMENDATION: ์ค‘๊ตญ์–ด leakage๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ safety repair๋ฅผ ์šฐ์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.")
elif set(obj.get("category_counts", {}).keys()).issubset({"systemd", "jsonl", "cuda"}):
print("RECOMMENDATION: ์ „์ฒด ์žฌํ•™์Šต๋ณด๋‹ค systemd/jsonl/cuda low-item repair๋งŒ ๊ณ ๋ คํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.")
else:
print("RECOMMENDATION: ์‹คํŒจ ๋ฒ”์œ„๊ฐ€ ๋„“์Šต๋‹ˆ๋‹ค. ์‹คํŒจ ํ•ญ๋ชฉ ๋‚ด์šฉ์„ ๋จผ์ € ๊ฒ€ํ† ํ•œ ๋’ค repair ๋ฒ”์œ„๋ฅผ ์ •ํ•˜์‹œ๋Š” ๊ฒŒ ์ข‹์Šต๋‹ˆ๋‹ค.")
else:
print("FAILED_JSON: not found")
print("RECOMMENDATION: ๋จผ์ € 02_extract_failed_items.py๋ฅผ ์‹คํ–‰ํ•ด ์ฃผ์„ธ์š”.")
print()
if repair_jsonl:
rows = sum(1 for _ in repair_jsonl.open("r", encoding="utf-8"))
print("REPAIR_DATASET:", repair_jsonl)
print("REPAIR_ROWS:", rows)
else:
print("REPAIR_DATASET: not created yet")
if __name__ == "__main__":
main()