-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_failed.py
More file actions
44 lines (34 loc) · 1.19 KB
/
check_failed.py
File metadata and controls
44 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
import os
import glob
runs_dir = # top folder with your run directories
log_name = "log.txt" # change if needed
keywords = ["termination code"] # search terms
expected_end = "termination code" # string that indicates a clean finish
# SCAN RUNS
unique_msgs = set()
timeout_runs = []
for run_path in glob.glob(os.path.join(runs_dir, "*")):
if not os.path.isdir(run_path):
continue
log_file = os.path.join(run_path, log_name)
if not os.path.exists(log_file):
continue
with open(log_file, "r", errors="ignore") as f:
lines = f.readlines()
# check for failure/termination messages
found_msg = False
for line in lines:
if any(key in line.lower() for key in keywords):
unique_msgs.add(line.strip())
found_msg = True
# if no keyword found at all → probably incomplete
if not found_msg:
timeout_runs.append(run_path)
# OUTPUT
print(f"Found {len(unique_msgs)} unique termination/failure messages:\n")
for msg in sorted(unique_msgs):
print(" -", msg)
print("\nRuns that may have timed out / incomplete (no termination code found):")
for run in timeout_runs:
print(" -", run)