this repo has no description
at main 22 lines 671 B view raw
1#!/usr/bin/env python3 2from sys import argv 3from pathlib import Path 4 5log_path = Path(argv[1]) 6sections_path = log_path.parent / "sections" 7sections_path.mkdir(exist_ok=True) 8f = log_path.open("r") 9 10sections = f.read().split("[0Ksection_start") 11 12for section in sections: 13 try: 14 section_name = section.split("\n")[0].split(":")[2] 15 if "cost-model" not in section_name and "compare" not in section_name: 16 continue 17 out_path = sections_path / section_name 18 out_path.touch 19 out_path.write_text(section) 20 print("wrote section", section_name, "to", out_path) 21 except Exception as e: 22 print("in one section", e)