For 1.9.0 release (#1096) #802
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Pyspy Profiling Test | |
on: | |
pull_request: | |
branches: | |
- 'develop' | |
- 'develop-1.9' | |
paths: | |
- '**' | |
- '!docs/**' | |
- '!*.rst' | |
- '!*.md' | |
- '!datacube_ows/__init__.py' | |
- '!.github/**' | |
- '.github/workflows/pyspy-profiling.yaml' | |
push: | |
branches: | |
- 'develop' | |
- 'develop-1.9' | |
paths: | |
- '**' | |
- '!docs/**' | |
- '!*.rst' | |
- '!*.md' | |
- '!datacube_ows/__init__.py' | |
- '!.github/**' | |
- '.github/workflows/pyspy-profiling.yaml' | |
# When a PR is updated, cancel the jobs from the previous version. Merges | |
# do not define head_ref, so use run_id to never cancel those jobs. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Run performance profiling | |
- name: setup performance profiling with py-spy (stage 1 - run profiling containers) | |
run: | | |
export LOCAL_UID=$(id -u $USER) | |
export LOCAL_GID=$(id -g $USER) | |
export $(grep -v '^#' .env_simple | xargs) | |
docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml up -d | |
- name: Sleep for 10 seconds (stage 1 - wait for services to be ready) | |
uses: whatnick/wait-action@master | |
with: | |
time: '10s' | |
- name: set output container pid (stage 1 - get ows container pid) | |
id: set-output-container-id | |
run: | | |
export LOCAL_UID=$(id -u $USER) | |
export LOCAL_GID=$(id -g $USER) | |
export $(grep -v '^#' .env_simple | xargs) | |
echo "PID=$(docker inspect --format '{{.State.Pid}}' $(docker inspect -f '{{.Name}}' \ | |
$(docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml ps -q ows) \ | |
| cut -c2-))" > $GITHUB_OUTPUT | |
- name: Run py-spy profiling (stage 1 - run profiling service) | |
timeout-minutes: 1 | |
continue-on-error: true | |
run: | | |
export LOCAL_UID=$(id -u $USER) | |
export LOCAL_GID=$(id -g $USER) | |
export $(grep -v '^#' .env_simple | xargs) | |
docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \ | |
exec -T ows /bin/sh -c "cd /code && ./test_urls.sh &" | |
docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \ | |
run pyspy record -f speedscope -o ./artifacts/profile.json --duration 30 \ | |
--pid ${{steps.set-output-container-id.outputs.PID}} --subprocesses | |
- name: Stop py-spy profiling after timeout (stage 1 - stop profiling) | |
run: | | |
export $(grep -v '^#' .env_simple | xargs) | |
docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml down | |
- name: Upload profile to artifact (stage 1 - Upload profiling svg to artifacts) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: profile.json | |
path: ./artifacts/profile.json |