Skip to content

Commit

Permalink
Add auto retries for Captum OSS GitHub Actions (pytorch#1408)
Browse files Browse the repository at this point in the history
Summary:

We frequently see sporadic failures in Captum GitHub actions test workflows, often related to package download, http errors, conda environment setup, etc.

We add auto-retries to automatically retry failed workflows rather than needing to do this manually.

Differential Revision: D64693773
  • Loading branch information
Vivek Miglani authored and facebook-github-bot committed Oct 21, 2024
1 parent ed5daa3 commit 721d621
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/retry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Retry Test
on:
workflow_dispatch:
inputs:
run_id:
required: true
jobs:
rerun-on-failure:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed
15 changes: 15 additions & 0 deletions .github/workflows/test-conda-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,18 @@ jobs:
# Run Tests
python3 -m pytest -ra --cov=. --cov-report term-missing
auto-retry:
name: Auto retry on failure
needs: tests
if: failure() && fromJSON(github.run_attempt) < 2
runs-on: ubuntu-latest
steps:
- name: Start rerun workflow
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh workflow run retry.yml \
-F run_id=${{ github.run_id }}
15 changes: 15 additions & 0 deletions .github/workflows/test-pip-cpu-with-mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,18 @@ jobs:
./scripts/run_mypy.sh
# Run Tests
python3 -m pytest -ra --cov=. --cov-report term-missing
auto-retry:
name: Auto retry on failure
needs: tests
if: failure() && fromJSON(github.run_attempt) < 2
runs-on: ubuntu-latest
steps:
- name: Start rerun workflow
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh workflow run retry.yml \
-F run_id=${{ github.run_id }}
15 changes: 15 additions & 0 deletions .github/workflows/test-pip-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,18 @@ jobs:
./scripts/install_via_pip.sh ${{ matrix.pytorch_args }} ${{ matrix.transformers_args }}
# Run Tests
python3 -m pytest -ra --cov=. --cov-report term-missing
auto-retry:
name: Auto retry on failure
needs: tests
if: failure() && fromJSON(github.run_attempt) < 2
runs-on: ubuntu-latest
steps:
- name: Start rerun workflow
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh workflow run retry.yml \
-F run_id=${{ github.run_id }}
15 changes: 15 additions & 0 deletions .github/workflows/test-pip-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ jobs:
# Run Tests
python3 -m pytest -ra --cov=. --cov-report term-missing
auto-retry:
name: Auto retry on failure
needs: tests
if: failure() && fromJSON(github.run_attempt) < 2
runs-on: ubuntu-latest
steps:
- name: Start rerun workflow
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh workflow run retry.yml \
-F run_id=${{ github.run_id }}

0 comments on commit 721d621

Please sign in to comment.