Skip to content

Commit a3228ce

Browse files
committed
Add centralized error classification workflow and fix missing fields
1 parent d757835 commit a3228ce

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Classify All Workflow Errors
2+
3+
# Trigger after specific workflows complete
4+
on:
5+
workflow_run:
6+
workflows:
7+
- "CI Test Suite"
8+
- "Copyright Checks"
9+
- "Container Validation (Dynamo)"
10+
- "Pre Merge"
11+
- "Nightly CI Pipeline"
12+
- "Post-Merge CI Pipeline"
13+
- "NVIDIA Test Lab Validation"
14+
types: [completed]
15+
16+
permissions:
17+
actions: read
18+
checks: write
19+
contents: read
20+
pull-requests: write
21+
22+
jobs:
23+
classify-errors:
24+
name: Classify Workflow Errors
25+
runs-on: ubuntu-latest
26+
# Only run if the triggering workflow failed
27+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.workflow_run.head_branch }}
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.11'
39+
40+
- name: Install dependencies
41+
run: |
42+
python3 -m venv /tmp/error-classification-venv
43+
. /tmp/error-classification-venv/bin/activate
44+
pip install -r opensearch_upload/requirements.txt
45+
46+
- name: Classify All Workflow Errors
47+
env:
48+
# NVIDIA API Configuration (Claude via NVIDIA inference API)
49+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
50+
API_FORMAT: "openai"
51+
API_BASE_URL: "https://inference-api.nvidia.com/v1"
52+
ANTHROPIC_MODEL: "aws/anthropic/claude-opus-4-5"
53+
54+
# Feature flags
55+
ENABLE_ERROR_CLASSIFICATION: "true"
56+
ENABLE_GITHUB_ANNOTATIONS: "true"
57+
ENABLE_PR_COMMENTS: "true"
58+
59+
# GitHub context
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
# OpenSearch (optional)
63+
ERROR_CLASSIFICATION_INDEX: ${{ secrets.ERROR_CLASSIFICATION_INDEX }}
64+
OPENSEARCH_URL: ${{ secrets.OPENSEARCH_URL }}
65+
OPENSEARCH_USERNAME: ${{ secrets.OPENSEARCH_USERNAME }}
66+
OPENSEARCH_PASSWORD: ${{ secrets.OPENSEARCH_PASSWORD }}
67+
68+
# Performance tuning
69+
MAX_PARALLEL_JOBS: "5"
70+
run: |
71+
. /tmp/error-classification-venv/bin/activate
72+
python3 .github/workflows/classify_workflow_errors.py || echo "⚠️ Classification failed but continuing"
73+
74+
- name: Upload Classification Results (if available)
75+
if: always()
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: error-classification-results
79+
path: |
80+
/tmp/error-classification-*.json
81+
retention-days: 7
82+
if-no-files-found: ignore

opensearch_upload/error_classification/classifier.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class ErrorClassification:
2323
# Source references
2424
workflow_id: Optional[str] = None
2525
job_id: Optional[str] = None
26+
job_name: Optional[str] = None
2627
step_id: Optional[str] = None
28+
step_name: Optional[str] = None
2729
test_name: Optional[str] = None
2830

2931
# Error source
@@ -77,7 +79,9 @@ def to_opensearch_doc(self) -> Dict[str, Any]:
7779
# Source references
7880
"s_workflow_id": self.workflow_id,
7981
"s_job_id": self.job_id,
82+
"s_job_name": self.job_name,
8083
"s_step_id": self.step_id,
84+
"s_step_name": self.step_name,
8185
"s_test_name": self.test_name,
8286

8387
# Error source

0 commit comments

Comments
 (0)