Skip to content

Commit 04a9885

Browse files
committed
Updates upstream mgmn metric table creation and ensures no collision of
metrics
1 parent 37265c3 commit 04a9885

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

.github/workflows/_sitrep_mgmn.yaml

+18-8
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,23 @@ jobs:
6060
shell: bash -x -e {0}
6161
run: |
6262
METRICS_SUMMARY_FILE="metrics_summary.json"
63-
echo -e "\n\n## ${{ inputs.FW_NAME }} MGMN Test Metrics" >> $METRICS_SUMMARY_FILE
64-
for i in metrics-test-log/*_metrics.json; do
65-
echo $i | cut -d'.' -f1
66-
echo '```json'
67-
jq . $i
68-
echo '```'
69-
done | tee -a $METRICS_SUMMARY_FILE
63+
64+
echo '## Upstream ${{ inputs.FW_NAME }} MGMN Test Metrics' | tee -a $METRICS_SUMMARY_FILE
65+
python <<EOF | tee -a $METRICS_SUMMARY_FILE
66+
import json
67+
files = "$(echo upstream-${{ inputs.FW_NAME }}-metrics-test-log/*_metrics.json)".split()
68+
header = None
69+
print_row = lambda lst: print('| ' + ' | '.join(str(el) for el in lst) + ' |')
70+
for path in files:
71+
with open(path) as f:
72+
obj = json.loads(f.read())
73+
if not header:
74+
header = list(obj.keys())
75+
print_row(["Job Name"] + header)
76+
print_row(["---"] * (1+len(header)))
77+
job_name = path[:-len('_metrics.json')]
78+
print_row([job_name] + [obj[h] for h in header])
79+
EOF
7080
7181
cat $METRICS_SUMMARY_FILE >> $GITHUB_STEP_SUMMARY
7282
echo "METRICS_SUMMARY_FILE=$METRICS_SUMMARY_FILE" >> ${GITHUB_OUTPUT}
@@ -83,7 +93,7 @@ jobs:
8393
failed_tests=$(jq -r '. | select ((.state != "COMPLETED") or (.exitcode != "0")) | .state' $EXIT_STATUSES | wc -l)
8494
total_tests=$(ls $EXIT_STATUSES | wc -l)
8595
86-
METRICS_LOG=metrics-test-log/report.jsonl
96+
METRICS_LOG=upstream-${{ inputs.FW_NAME }}-metrics-test-log/report.jsonl
8797
all_outcomes() {
8898
cat $METRICS_LOG | jq -r '. | select((.["$report_type"] == "TestReport") and (.when == "call")) | .outcome'
8999
}

.github/workflows/_test_pax.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ jobs:
474474
- name: Upload metrics test json logs
475475
uses: actions/upload-artifact@v3
476476
with:
477-
name: metrics-test-log
477+
name: upstream-${{ inputs.FW_NAME }}-metrics-test-log
478478
path: |
479479
report.jsonl
480480
*_metrics.json

.github/workflows/_test_t5x.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ jobs:
320320
- name: Upload metrics test json logs
321321
uses: actions/upload-artifact@v3
322322
with:
323-
name: metrics-test-log
323+
name: upstream-${{ inputs.FW_NAME }}-metrics-test-log
324324
path: |
325325
report.jsonl
326326
*_metrics.json

0 commit comments

Comments
 (0)