Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce execution time of tests #429

Merged
merged 83 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
2994a99
Combine tox test environments into single 'tests' environment
AnesBenmerzoug Sep 13, 2023
7cb5b92
Bump mypy version to 1.5.1
AnesBenmerzoug Sep 18, 2023
4233e5c
Fix all type hint errors
AnesBenmerzoug Sep 18, 2023
c2b02a6
Merge branch 'develop' into fix/reduce-execution-time-of-tests
AnesBenmerzoug Sep 18, 2023
c2b43fb
Fix sampler type hints
AnesBenmerzoug Sep 18, 2023
9e0d96c
Cache .mypy_cache directory in CI
AnesBenmerzoug Sep 18, 2023
086c388
Put mypy version before python location in mypy CI cache key
AnesBenmerzoug Sep 18, 2023
37be320
Move tolerate plugin to separate module
AnesBenmerzoug Sep 18, 2023
ee92c47
Fix tox invocation in CI
AnesBenmerzoug Sep 18, 2023
ee46cc6
Add ray extra to tox tests environment
AnesBenmerzoug Sep 25, 2023
c2c249e
Create cloudpickle pytest cache provider
AnesBenmerzoug Sep 25, 2023
3f0dac5
Remove import of parallel from pydvl.utils
AnesBenmerzoug Sep 25, 2023
e9beee5
Cache result of linear_shapley fixture
AnesBenmerzoug Sep 25, 2023
d81e327
Reduce requirements for test_linear_montecarlo_shapley and use seed
AnesBenmerzoug Sep 25, 2023
c55a528
Further reduce valuation test runtime
AnesBenmerzoug Sep 25, 2023
90e3ab9
Add pytest-profiling to dev dependencies
AnesBenmerzoug Sep 25, 2023
9ae4a26
Run failed tests first
AnesBenmerzoug Sep 25, 2023
cad4e3e
Cache .pytest_cache directory in CI, store pytest-profiling graph as …
AnesBenmerzoug Sep 25, 2023
ed42757
Merge branch 'develop' into fix/reduce-execution-time-of-tests
AnesBenmerzoug Sep 25, 2023
ea14091
Add missing import
AnesBenmerzoug Sep 25, 2023
326d359
Remove profile from default pytest arguments
AnesBenmerzoug Sep 25, 2023
0989898
Fix issue with torch.empty
AnesBenmerzoug Sep 25, 2023
b8e3d1a
Ignore typing error in plot_ci_array
AnesBenmerzoug Sep 25, 2023
5068b32
Merge branch 'develop' into fix/reduce-execution-time-of-tests
AnesBenmerzoug Oct 23, 2023
153c5a6
Add pytest-cases as dev dependency and bump pytest version
AnesBenmerzoug Oct 23, 2023
536c841
Rewrite tests in test_influences.py using pytest-cases
AnesBenmerzoug Oct 23, 2023
354774f
Fix bug in solve_batch_cg
AnesBenmerzoug Oct 23, 2023
691e6e9
Fix type hints
AnesBenmerzoug Oct 23, 2023
a841af0
Define and use new pytest slow marker to skip slow tests by default
AnesBenmerzoug Oct 25, 2023
c585e79
Fix future cancellation test, simplify map reduce seeding test
AnesBenmerzoug Oct 25, 2023
10ec226
Allow passing seed to montecarlo least core
AnesBenmerzoug Oct 26, 2023
890d87f
Add pytest-split and pytest-sugar as requirements
AnesBenmerzoug Oct 26, 2023
b742711
Fix default value of max_failues in tolerate fixture
AnesBenmerzoug Oct 26, 2023
d383e92
Fix tests
AnesBenmerzoug Oct 26, 2023
362edf4
Add recorded test_durations
AnesBenmerzoug Oct 26, 2023
2c658d1
Use pytest-split to split tests into 3 groups in CI
AnesBenmerzoug Oct 26, 2023
e16e634
Update contributing guide
AnesBenmerzoug Oct 26, 2023
771571c
Use least_duration test splitting algorithm
AnesBenmerzoug Oct 26, 2023
6d19980
Fix CI file
AnesBenmerzoug Oct 26, 2023
29485a5
Use pytests's importorskip instead of try except
AnesBenmerzoug Oct 26, 2023
83e5b10
Use rng object instead of setting the seed globally
AnesBenmerzoug Oct 26, 2023
daebfb8
Fix setting pytest marker for a module
AnesBenmerzoug Oct 26, 2023
1d2b2de
Increase timeout for test_future_cancellation
AnesBenmerzoug Oct 26, 2023
a8af2f7
Remove pytest-profiling
AnesBenmerzoug Oct 26, 2023
f8aae61
Simplify test CI workflow and split tests into 4 groups instead of 3
AnesBenmerzoug Oct 26, 2023
c2b23e4
Rename notebook tests CI workflow
AnesBenmerzoug Oct 26, 2023
e20b8cf
Fix notebook tests CI workflow
AnesBenmerzoug Oct 26, 2023
ba3d13d
Customize tests CI job names, do not fail fast
AnesBenmerzoug Oct 26, 2023
7dac359
Pass seed to to map_reduce call inside test_memcached_parallel_repeat…
AnesBenmerzoug Oct 26, 2023
5d409d1
Except RayTaskError additionally in test_future_cancellation when can…
AnesBenmerzoug Oct 26, 2023
c5c6457
Remove unneeded check on the duration in test_future_cancellation
AnesBenmerzoug Oct 26, 2023
f3177e4
Update test durations
AnesBenmerzoug Oct 26, 2023
b92eb46
Add kwargs to PowersetSampler's init
AnesBenmerzoug Oct 26, 2023
3a2c858
Pass seed to sampler in test_banzhaf
AnesBenmerzoug Oct 26, 2023
c473679
Output pytest coverage report as xml
AnesBenmerzoug Oct 26, 2023
f4ab1a1
Update test coverage from CI
AnesBenmerzoug Oct 26, 2023
bb4b8d1
Remove unused report tox environment
AnesBenmerzoug Oct 26, 2023
f6f67bc
Fix cache key of pytest cache job on CI
AnesBenmerzoug Oct 26, 2023
d38d4a7
Fix tox cache key on CI
AnesBenmerzoug Oct 26, 2023
03791cc
Merge branch 'develop' into fix/reduce-execution-time-of-tests
mdbenito Oct 26, 2023
aa36a88
Add more detail to contributing doc
AnesBenmerzoug Oct 26, 2023
58d17cf
Revert back order of n_jobs and loss in compute_data_oob
AnesBenmerzoug Oct 26, 2023
1e799a8
Update changelog
AnesBenmerzoug Oct 26, 2023
4fc254c
Fix influence notebooks
AnesBenmerzoug Oct 26, 2023
83bdc22
Use nbmake to test notebooks
AnesBenmerzoug Oct 26, 2023
ed6650c
Disable parallel backend logging by default
AnesBenmerzoug Oct 26, 2023
4115278
Rerun least core notebook
AnesBenmerzoug Oct 26, 2023
7f81df0
Fix type hint
AnesBenmerzoug Oct 26, 2023
aea5404
Use tolerate marker on test_future_cancellation
AnesBenmerzoug Oct 27, 2023
1e435c8
Fix more notebooks to make them work on CI
AnesBenmerzoug Oct 27, 2023
7065173
Use warning instead of logging for message in joblib backend
AnesBenmerzoug Oct 27, 2023
c10d98c
Make shapley utility learning notebook work in CI
AnesBenmerzoug Oct 27, 2023
f275845
Set codecov action's verbosity to true
AnesBenmerzoug Oct 27, 2023
c312268
Specify file to coverage file for codecov action
AnesBenmerzoug Oct 27, 2023
49fabc2
Disable verbosity for codecov action
AnesBenmerzoug Oct 27, 2023
9342411
Add codecov badge to readme
AnesBenmerzoug Oct 27, 2023
f580aa7
Reorder badges in README
AnesBenmerzoug Oct 27, 2023
b57f553
Set sampler seed in test_shapley
AnesBenmerzoug Oct 27, 2023
eab28d4
Update changelog
AnesBenmerzoug Oct 27, 2023
9d3969c
Fix links to documentation in readme
AnesBenmerzoug Oct 27, 2023
7a409a4
Move --splitting-algorithm parameter to pyproject.toml
AnesBenmerzoug Oct 29, 2023
88a0319
Document where the cache fixture is used
AnesBenmerzoug Oct 29, 2023
549c3dc
Add note about when to update test durations
AnesBenmerzoug Oct 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
pre-commit run --all --show-diff-on-failure
python build_scripts/run_pylint.py | (pylint-json2html -f jsonextended -o pylint.html)
shell: bash
- name: Generate mypy cache key
id: generate-mypy-cache-key
run: |
MYPY_VERSION=$(mypy --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
echo "key=mypy-$MYPY_VERSION-${{ env.pythonLocation }}" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: .mypy_cache
key: ${{ steps.generate-mypy-cache-key.outputs.key }}
- name: Check Type Hints
run: mypy src/
docs:
Expand All @@ -57,40 +66,32 @@ jobs:
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Build Docs
run: mkdocs build
base-tests:
group-tests:
strategy:
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run base tests
group_number: [1, 2, 3, 4]
name: Run Tests - Python ${{ matrix.python_version }} - Group ${{ matrix.group_number }}
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: base
python_version: ${{ matrix.python_version }}
needs: [code-quality]
torch-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run tests that use PyTorch
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: torch
split_size: 4
group_number: ${{ matrix.group_number }}
python_version: ${{ matrix.python_version }}
needs: [code-quality]
notebook-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run notebook tests
uses: ./.github/workflows/run-tests-workflow.yaml
name: Run Notebook tests - Python ${{ matrix.python_version }}
uses: ./.github/workflows/run-notebook-tests-workflow.yaml
with:
tests_to_run: notebooks
python_version: ${{ matrix.python_version }}
needs: [code-quality]
push-docs-and-release-testpypi:
name: Push Docs and maybe release Package to TestPyPI
runs-on: ubuntu-latest
needs: [docs, base-tests, torch-tests, notebook-tests]
needs: [docs, group-tests, notebook-tests]
if: ${{ github.ref == 'refs/heads/develop' }}
concurrency:
group: publish
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/run-notebook-tests-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Notebook Tests

on:
workflow_call:
inputs:
python_version:
description: "Determines which Python version to use"
type: string
required: true

env:
PY_COLORS: 1

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python ${{ inputs.python_version }}
uses: ./.github/actions/python
with:
python_version: ${{ inputs.python_version }}
- name: Cache Tox Directory for Tests
uses: actions/cache@v3
with:
key: tox-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('tox.ini', 'requirements.txt') }}-${{ inputs.python_version }}
path: .tox
- name: Set up memcached
uses: niden/actions-memcached@v7
- name: Test Notebooks
run: tox -e notebook-tests
continue-on-error: true
29 changes: 16 additions & 13 deletions .github/workflows/run-tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Run Tests
on:
workflow_call:
inputs:
tests_to_run:
description: "Determines which tests to run using Tox. Should be one of: base, torch, notebooks"
split_size:
description: "Determines the number of groups into which the tests should be split"
type: string
default: 4
group_number:
description: "Determines which which group of tests to run. Can be 1, 2, ..., split_size"
type: string
required: true
python_version:
Expand All @@ -29,17 +33,16 @@ jobs:
- name: Cache Tox Directory for Tests
uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini', 'requirements.txt') }}
key: tox-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('tox.ini', 'requirements.txt') }}-${{ inputs.python_version }}
path: .tox
- name: Set up memcached
uses: niden/actions-memcached@v7
- name: Test Base Modules
run: tox -e base
if: inputs.tests_to_run == 'base'
- name: Test Modules that rely on PyTorch
run: tox -e torch
if: inputs.tests_to_run == 'torch'
- name: Test Notebooks
run: tox -e notebooks
if: inputs.tests_to_run == 'notebooks'
continue-on-error: true
- name: Test Group ${{ inputs.group_number }}
run: tox -e tests -- --slow-tests --splits ${{ inputs.split_size }} --group ${{ inputs.group_number }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
env_vars: OS,PYTHON
verbose: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,6 @@ data/models/

# Docs
docs_build

# pytest-profiling
prof/
Loading
Loading