Skip to content

Commit

Permalink
Localise pytools cache to each runner
Browse files Browse the repository at this point in the history
Previously we were sharing a cache between runners ($XDG_CACHE_HOME is
in the home directory) and so different would be clearing it at
different times.
  • Loading branch information
connorjward committed Jan 16, 2025
1 parent 9c5ec2f commit f4fca69
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
FIREDRAKE_CI_TESTS: 1 # needed to symlink the checked out branch into the venv
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Add homebrew to PATH
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
Expand All @@ -35,7 +36,7 @@ jobs:
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
rm -rf firedrake_venv "$XDG_CACHE_HOME"
- name: Install Python
run: brew install python python-setuptools
- name: Build Firedrake
Expand All @@ -58,4 +59,4 @@ jobs:
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
rm -rf firedrake_venv "$XDG_CACHE_HOME"
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ jobs:
OPENBLAS_NUM_THREADS: 1
COMPLEX: ${{ matrix.complex }}
RDMAV_FORK_SAFE: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- uses: actions/checkout@v4
- name: Cleanup
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
rm -rf firedrake_venv "$XDG_CACHE_HOME"
- name: Build Firedrake
run: |
cd ..
Expand Down Expand Up @@ -134,7 +135,7 @@ jobs:
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
rm -rf firedrake_venv "$XDG_CACHE_HOME"
docker_tag:
name: "Set the Docker release tag"
runs-on: [self-hosted, Linux]
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pip-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
env:
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Add homebrew to PATH
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
Expand All @@ -36,7 +37,7 @@ jobs:
- name: Cleanup (pre)
if: ${{ always() }}
run: |
rm -rf pip_venv
rm -rf pip_venv "$XDG_CACHE_HOME"
"$(brew --prefix)/bin/python3" -m pip cache purge
- name: Create a virtual environment
Expand Down Expand Up @@ -108,5 +109,5 @@ jobs:
- name: Cleanup (post)
if: ${{ always() }}
run: |
rm -rf pip_venv
rm -rf pip_venv "$XDG_CACHE_HOME"
"$(brew --prefix)/bin/python3" -m pip cache purge
5 changes: 3 additions & 2 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ jobs:
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
RDMAV_FORK_SAFE: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- name: Cleanup
if: ${{ always() }}
run: rm -rf pip_venv
run: rm -rf pip_venv "$XDG_CACHE_HOME"

- name: Create a venv
run: |
Expand Down Expand Up @@ -107,4 +108,4 @@ jobs:
- name: Cleanup
# Belt and braces: clean up before and after the run.
if: ${{ always() }}
run: rm -rf pip_venv
run: rm -rf pip_venv "$XDG_CACHE_HOME"
9 changes: 9 additions & 0 deletions .github/workflows/pyop2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ jobs:
PETSC_ARCH: default
RDMAV_FORK_SAFE: 1
PYOP2_CI_TESTS: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
timeout-minutes: 60

steps:
- name: Pre-run cleanup
if: ${{ always() }}
run: rm -rf firedrake "$XDG_CACHE_HOME"

- name: Install system dependencies
shell: bash
run: |
Expand Down Expand Up @@ -91,3 +96,7 @@ jobs:
mpiexec -n 2 --oversubscribe pytest -m "parallel[2]" --tb=native --timeout=480 --timeout-method=thread -o faulthandler_timeout=540 -v tests/pyop2
mpiexec -n 3 --oversubscribe pytest -m "parallel[3]" --tb=native --timeout=480 --timeout-method=thread -o faulthandler_timeout=540 -v tests/pyop2
timeout-minutes: 10

- name: Post-run cleanup
if: ${{ always() }}
run: rm -rf firedrake "$XDG_CACHE_HOME"

0 comments on commit f4fca69

Please sign in to comment.