Skip to content

[pre-commit.ci] pre-commit autoupdate #740

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #740

---
name: Pyspy Profiling Test
on:
pull_request:
branches:
- 'master'
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
- '!.github/**'
- '.github/workflows/pyspy-profiling.yaml'
push:
branches:
- 'master'
paths:
- '**'
- '!docs/**'
- '!*.rst'
- '!*.md'
- '!datacube_ows/__init__.py'
- '!.github/**'
- '.github/workflows/pyspy-profiling.yaml'
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_18) \
| 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_18 /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