Skip to content

Commit acf8550

Browse files
committed
Update logs
1 parent 3d42a25 commit acf8550

File tree

1 file changed

+76
-1
lines changed

1 file changed

+76
-1
lines changed

scripts/print_aggregated_errors.py

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import json
33
import sys
4+
import glob
45

56
ERROR_DIR = "test_output" # Directory where error files are stored
67

@@ -28,13 +29,87 @@ def load_aggregated_error_file():
2829

2930
return {}
3031

32+
def combine_error_files():
33+
"""Combine all error files from parallel Jenkins stages"""
34+
combined_errors = {}
35+
36+
# Look for error files in the current directory and subdirectories
37+
error_patterns = [
38+
"test_output/errors_*.json",
39+
"*/test_output/errors_*.json", # For archived workspaces
40+
"**/test_output/errors_*.json" # For nested archived workspaces
41+
]
42+
43+
for pattern in error_patterns:
44+
for error_file in glob.glob(pattern, recursive=True):
45+
try:
46+
with open(error_file, 'r') as f:
47+
node_errors = json.load(f)
48+
49+
# Extract node name from filename
50+
filename = os.path.basename(error_file)
51+
node_name = filename.replace("errors_", "").replace(".json", "").replace("_", " ")
52+
53+
if node_name not in combined_errors:
54+
combined_errors[node_name] = {}
55+
56+
# Merge errors
57+
for error_key, count in node_errors.items():
58+
if error_key in combined_errors[node_name]:
59+
combined_errors[node_name][error_key] += count
60+
else:
61+
combined_errors[node_name][error_key] = count
62+
63+
except Exception as e:
64+
print(f"⚠️ Failed to read {error_file}: {str(e)}")
65+
66+
return combined_errors
67+
3168
def print_error_summary():
3269
print("\n\n📊 Error Breakdown by Node:\n")
3370

3471
# Check if a specific node is being tested
3572
node_to_test = os.getenv("NODE_TO_TEST")
3673

37-
# Try individual files first (preferred method)
74+
# First try to combine all error files from parallel execution
75+
combined_errors = combine_error_files()
76+
77+
if combined_errors:
78+
print("📁 Using combined error files from parallel execution:")
79+
80+
# If a specific node is being tested, only show that node's errors
81+
if node_to_test:
82+
if node_to_test in combined_errors:
83+
print(f"🔧 {node_to_test}")
84+
node_errors = combined_errors[node_to_test]
85+
86+
if not node_errors:
87+
print(" ✅ No errors")
88+
else:
89+
for error_key, count in node_errors.items():
90+
print(f" • {count}x {error_key}")
91+
print()
92+
else:
93+
print(f"🔧 {node_to_test}")
94+
print(" ✅ No errors")
95+
print()
96+
else:
97+
# Show all nodes
98+
for node_name in sorted(combined_errors.keys()):
99+
print(f"🔧 {node_name}")
100+
101+
node_errors = combined_errors[node_name]
102+
103+
if not node_errors:
104+
print(" ✅ No errors")
105+
else:
106+
for error_key, count in node_errors.items():
107+
print(f" • {count}x {error_key}")
108+
109+
print()
110+
return
111+
112+
# Fallback to original logic
38113
error_files = load_error_files()
39114

40115
if error_files:

0 commit comments

Comments
 (0)