Skip to content

Commit 093d51a

Browse files
committed
clean up design
1 parent 946e579 commit 093d51a

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

qa/tools/apex_algorithm_qa_tools/test_failure_handler.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_existing_issues():
2727
response.raise_for_status()
2828
return {issue["title"]: issue for issue in response.json()}
2929
except Exception as e:
30-
logger.error(f"Failed to fetch issues: {str(e)}")
30+
logger.error(f"Failed to fetch issues: {str(e)} - Response: {response.text}")
3131
return {}
3232

3333
def get_scenario_details(scenario_id):
@@ -64,7 +64,8 @@ def parse_failed_tests():
6464
failures = []
6565

6666
# Match failed test entries with their logs
67-
pattern = r"=+ FAILURES =+\n.*?_* (test_run_benchmark\[(.*?)\])(.*?)(?=\n=+|\Z)"
67+
pattern = r"=+ FAILURES =+\n.*?_* (test_run_benchmark\[(.*?)\])(?:.*?)\n(.*?)(?=\n=+|\Z)"
68+
6869
matches = re.finditer(pattern, content, re.DOTALL)
6970

7071
for match in matches:
@@ -90,24 +91,34 @@ def build_issue_body(scenario, logs, failure_count):
9091
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
9192

9293
return f"""
93-
SCENARIO FAILURE REPORT
94-
95-
Scenario ID: {scenario['id']}
96-
Description: {scenario.get('description', 'No description available')}
97-
Backend System: {scenario['backend']}
98-
Failure Count: {failure_count}
99-
Timestamp: {timestamp}
100-
101-
PROCESS GRAPH:
102-
{scenario['process_graph']}
94+
## Benchmark Failure: {scenario['id']}
10395
104-
ERROR LOGS:
105-
{logs}
10696
107-
LINKS:
97+
**Scenario ID**: {scenario['id']}
98+
**Backend System**: {scenario['backend']}
99+
**Failure Count**: {failure_count}
100+
**Timestamp**: {timestamp}
101+
**LINKS**:
108102
- Workflow Run: {WORKFLOW_BASE_URL}
109103
- Scenario Definition: {get_scenario_link(scenario['id'])}
110104
- Artifacts: {WORKFLOW_BASE_URL}#artifacts
105+
106+
---
107+
108+
### Technical Details
109+
110+
**PROCESS GRAPH:**
111+
f"```json\n"
112+
f"{scenario['process_graph']}\n"
113+
f"```\n\n"
114+
115+
**ERROR LOGS:**
116+
f"```plaintext\n"
117+
f"{logs}\n"
118+
f"```"
119+
120+
121+
111122
"""
112123

113124
def get_scenario_link(scenario_id):
@@ -153,10 +164,10 @@ def update_existing_issue(issue, scenario, new_logs):
153164
update_section = f"""
154165
NEW FAILURE OCCURRENCE
155166
156-
Timestamp: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
157-
Workflow Run: {WORKFLOW_BASE_URL}
167+
**Timestamp**: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
168+
**Workflow Run**: {WORKFLOW_BASE_URL}
158169
159-
Latest Logs:
170+
**Error Logs**:
160171
{new_logs}
161172
"""
162173

@@ -177,7 +188,6 @@ def main():
177188

178189
for failure in failed_tests:
179190
scenario_id = failure["scenario_id"]
180-
test_name = failure["test_name"]
181191
logs = failure["logs"]
182192

183193
# Get scenario technical details

0 commit comments

Comments
 (0)