Skip to content

Commit 8c5b917

Browse files
committed
Parse sitrep from pytest json report
1 parent 5f500f0 commit 8c5b917

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

.github/eks-workflow-files/transformer-engine/scripts/unittest.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77
export TE_PATH=${SRC_PATH_TRANSFORMER_ENGINE}
88

99
# 1 GPU per worker, 6 workers per GPU
10-
pytest-xdist.sh 1 6 pytest-report-L0-unittest.jsonl bash ${TE_PATH}/qa/L0_jax_unittest/test.sh | tee -a ${LOG_DIR}/tests.log
10+
pytest-xdist.sh 1 6 pytest-report-L0-unittest.jsonl bash ${TE_PATH}/qa/L0_jax_unittest/test.sh | tee -a ${LOG_DIR}/pytest_stdout.log
1111

1212
# 8 GPUs per worker, 1 worker per GPU. pytest-xdist.sh allows aggregation
1313
# into a single .jsonl file of results from multiple pytest invocations
1414
# inside the test.sh script, so it's useful even with a single worker per
1515
# device.
16-
pytest-xdist.sh 8 1 pytest-report-L0-distributed-unittest.jsonl bash ${TE_PATH}/qa/L0_jax_distributed_unittest/test.sh | tee -a ${LOG_DIR}/tests.log
17-
pytest-xdist.sh 8 1 pytest-report-L1-distributed-unittest.jsonl bash ${TE_PATH}/qa/L1_jax_distributed_unittest/test.sh | tee -a ${LOG_DIR}/tests.log
18-
19-
touch /opt/output/done
16+
pytest-xdist.sh 8 1 pytest-report-L0-distributed-unittest.jsonl bash ${TE_PATH}/qa/L0_jax_distributed_unittest/test.sh | tee -a ${LOG_DIR}/pytest_stdout.log
17+
pytest-xdist.sh 8 1 pytest-report-L1-distributed-unittest.jsonl bash ${TE_PATH}/qa/L1_jax_distributed_unittest/test.sh | tee -a ${LOG_DIR}/pytest_stdout.log
18+
19+
# merge the log files
20+
cat \
21+
pytest-report-L0-unittest.jsonl \
22+
pytest-report-L0-distributed-unittest.jsonl \
23+
pytest-report-L1-distributed-unittest.jsonl \
24+
> ${LOG_DIR}/pytest-report.jsonl
25+
26+
touch ${LOG_DIR}/done

.github/eks-workflow-files/transformer-engine/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ SCRIPT
3636
done
3737
3838
# Upload logs to S3 bucket
39-
cat /opt/output/tests.log
40-
aws s3 cp /opt/output/ s3://${S3_BUCKET}/${CI_NAME}/${RUN_ID}/ --recursive --exclude "*" --include "*.log"
39+
aws s3 cp /opt/output/ s3://${S3_BUCKET}/${CI_NAME}/${RUN_ID}/ --recursive
4140
env:
4241
- name: RUN_ID
4342
value: JOB_NAME

.github/workflows/_transformer_engine_eks.yaml

+11-11
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@ jobs:
8686
id: s3-logs-process
8787
run: |
8888
LOCAL_DIR=${{ inputs.CI_NAME }}-output
89+
REPORT_JSON=pytest-report.jsonl
8990
9091
mkdir -p $LOCAL_DIR
91-
# aws s3 cp s3://${{ inputs.S3_BUCKET }}/${{ inputs.CI_NAME }}/${{ env.RUN_NAME }}/summary.txt $LOCAL_DIR/
92-
aws s3 cp s3://${{ inputs.S3_BUCKET }}/${{ inputs.CI_NAME }}/${{ env.RUN_NAME }}/ $LOCAL_DIR/ --recursive --exclude "*" --include "*.log"
92+
aws s3 cp s3://${{ inputs.S3_BUCKET }}/${{ inputs.CI_NAME }}/${{ env.RUN_NAME }}/ $LOCAL_DIR/ --recursive
9393
94-
passed=$(cat $LOCAL_DIR/tests.log | grep 'PASSED opt/transformer' | wc -l || true)
95-
failed=$(cat $LOCAL_DIR/tests.log | grep 'FAILED opt/transformer' | wc -l || true)
94+
passed_tests=$(cat $LOCAL_DIR/$REPORT_JSON | jq --slurp | jq '.[] | select(.outcome == "passed") | .outcome' | wc -l || true)
95+
failed_tests=$(cat $LOCAL_DIR/$REPORT_JSON | jq --slurp | jq '.[] | select(.outcome == "failed") | .outcome' | wc -l || true)
9696
97-
total=$((failed + passed))
98-
echo "Passed tests: $passed"
99-
echo "Failed tests: $failed"
100-
echo "Total tests: $total"
101-
echo "PASSED_TESTS=$passed" >> $GITHUB_OUTPUT
102-
echo "FAILED_TESTS=$failed" >> $GITHUB_OUTPUT
103-
echo "TOTAL_TESTS=$total" >> $GITHUB_OUTPUT
97+
total_test=$((failed_tests + passed_tests))
98+
echo "Passed tests: $passed_tests"
99+
echo "Failed tests: $failed_tests"
100+
echo "Total tests: $total_tests"
101+
echo "PASSED_TESTS=$passed_tests" >> $GITHUB_OUTPUT
102+
echo "FAILED_TESTS=$failed_tests" >> $GITHUB_OUTPUT
103+
echo "TOTAL_TESTS=$total_tests" >> $GITHUB_OUTPUT
104104
105105
- name: Generate sitrep
106106
id: sitrep

0 commit comments

Comments
 (0)