Skip to content

Commit 348f515

Browse files
authored
Check permissions of pytest-tmp so GHA can process it (#1758)
This PR fixes an everlasting error in our CI. For `nsys-jax` tests on A100 we have this error when uploading artifacts ``` Error: EACCES: permission denied, scandir '/runner/_work/JAX-Toolbox/JAX-Toolbox/pytest-tmp' ``` Here, I am using a new folder for mounting results in docker and fixing permissions within the docker execution.
1 parent bdcb89f commit 348f515

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/_ci.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,23 @@ jobs:
335335
TEST_NAME: nsys-jax
336336
EXECUTE: |
337337
set -o pipefail
338+
mkdir -p output-results
338339
docker run -i --shm-size=1g --gpus all \
339-
-v $PWD:/opt/output \
340+
-v $PWD/output-results:/opt/output \
340341
${{ needs.build-jax.outputs.DOCKER_TAG_FINAL }} \
341342
bash <<"EOF" |& tee test-nsys-jax.log
342343
# nsys-jax is already installed, this is just adding the test dependencies
343344
pip install pytest-reportlog nsys-jax[test]
344345
# abuse knowledge that nsys-jax is installed editable, so the tests exist
345346
test_path=$(python -c 'import importlib.resources; print(importlib.resources.files("nsys_jax").joinpath("..", "tests").resolve())')
346347
pytest --basetemp=/opt/output/pytest-tmp --report-log=/opt/output/pytest-report.jsonl "${test_path}"
348+
chmod -R a+rwX /opt/output
347349
EOF
348350
STATISTICS_SCRIPT: |
349351
summary_line=$(tail -n1 test-nsys-jax.log)
350352
num_errors=$(echo $summary_line | grep -oE '[0-9]+ error' | awk '{print $1} END { if (!NR) print 0}')
351-
passed_tests=$(cat pytest-report.jsonl | jq -r 'select(."$report_type" == "TestReport" and .when == "call" and .outcome == "passed") | .outcome' | wc -l)
352-
failed_tests=$(cat pytest-report.jsonl | jq -r 'select(."$report_type" == "TestReport" and .when == "call" and .outcome == "failed") | .outcome' | wc -l)
353+
passed_tests=$(cat output-results/pytest-report.jsonl | jq -r 'select(."$report_type" == "TestReport" and .when == "call" and .outcome == "passed") | .outcome' | wc -l)
354+
failed_tests=$(cat output-results/pytest-report.jsonl | jq -r 'select(."$report_type" == "TestReport" and .when == "call" and .outcome == "failed") | .outcome' | wc -l)
353355
total_tests=$(( passed_tests + failed_tests ))
354356
echo "TOTAL_TESTS=${total_tests}" >> $GITHUB_OUTPUT
355357
echo "ERRORS=${num_errors}" >> $GITHUB_OUTPUT
@@ -358,8 +360,8 @@ jobs:
358360
ARTIFACTS: |
359361
# pytest-driven part
360362
test-nsys-jax.log
361-
pytest-report.jsonl
362-
pytest-tmp/
363+
output-results/pytest-report.jsonl
364+
output-results/pytest-tmp/
363365
secrets: inherit
364366

365367
# test-nsys-jax generates several fresh .zip archive outputs by running nsys-jax with real GPU hardware; this test

0 commit comments

Comments
 (0)