Skip to content

Commit

Permalink
debug benchmark post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Nov 14, 2023
1 parent 0f8b521 commit 94fc077
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: FloPy benchmarks

on:
push:
schedule:
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST)

Expand All @@ -12,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
python-version: [ 3.8 ] # 3.9, "3.10", "3.11", "3.12" ]
exclude:
# avoid shutil.copytree infinite recursion bug
# https://github.com/python/cpython/pull/17098
Expand Down Expand Up @@ -57,15 +58,13 @@ jobs:
if: failure()
with:
name: failed-benchmark-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
path: |
./autotest/.failed/**
path: autotest/.failed/**

- name: Upload benchmark result artifact
uses: actions/upload-artifact@v3
with:
name: benchmarks-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
path: |
./autotest/.benchmarks/**/*.json
path: autotest/.benchmarks/**/*.json

post_benchmark:
needs:
Expand Down Expand Up @@ -96,11 +95,17 @@ jobs:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ./autotest/.benchmarks
path: autotest/.benchmarks

- name: Process benchmark results
run: |
artifact_json=$(gh api -X GET -H "Accept: application/vnd.github+json" /repos/modflowpy/flopy/actions/artifacts)
repo="${{ github.repository }}"
path="autotest/.benchmarks"
# list benchmark artifacts
artifact_json=$(gh api -X GET -H "Accept: application/vnd.github+json" /repos/$repo/actions/artifacts)
# get artifact ids and download artifacts
get_artifact_ids="
import json
import sys
Expand All @@ -113,12 +118,16 @@ jobs:
"
echo $artifact_json \
| python -c "$get_artifact_ids" \
| xargs -I@ bash -c "gh api -H 'Accept: application/vnd.github+json' /repos/modflowpy/flopy/actions/artifacts/@/zip >> ./autotest/.benchmarks/@.zip"
zipfiles=( ./autotest/.benchmarks/*.zip )
| xargs -I@ bash -c "gh api -H 'Accept: application/vnd.github+json' /repos/$repo/actions/artifacts/@/zip >> $path/@.zip"
# unzip artifacts
zipfiles=( $path/*.zip )
if (( ${#zipfiles[@]} )); then
unzip -o './autotest/.benchmarks/*.zip' -d ./autotest/.benchmarks
unzip -o "$path/*.zip" -d $path
fi
python ./scripts/process_benchmarks.py ./autotest/.benchmarks ./autotest/.benchmarks
# process benchmarks
python scripts/process_benchmarks.py $path $path
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -127,5 +136,5 @@ jobs:
with:
name: benchmarks-${{ github.run_id }}
path: |
./autotest/.benchmarks/*.csv
./autotest/.benchmarks/*.png
autotest/.benchmarks/*.csv
autotest/.benchmarks/*.png

0 comments on commit 94fc077

Please sign in to comment.