Skip to content

Commit 15ba145

Browse files
Split tests into groups for parallel execution in CI/CD runners (#417)
Split tests into groups for parallel execution in CI/CD runners [ committed by @billschereriii ] [ reviewed by @al-rigazzi @ankona ]
1 parent 96765d9 commit 15ba145

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+181
-45
lines changed

.github/workflows/run_tests.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ env:
4444

4545
jobs:
4646
run_tests:
47-
name: Run tests with ${{ matrix.os }}, Python ${{ matrix.py_v}}, RedisAI ${{ matrix.rai }}
47+
name: Run tests ${{ matrix.subset }} with ${{ matrix.os }}, Python ${{ matrix.py_v}}, RedisAI ${{ matrix.rai }}
4848
runs-on: ${{ matrix.os }}
4949
strategy:
5050
fail-fast: false
5151
matrix:
52+
subset: [backends, slow_tests, group_a, group_b]
5253
os: [macos-12, ubuntu-20.04] # Operating systems
5354
compiler: [8] # GNU compiler version
5455
rai: [1.2.7] # Redis AI versions
@@ -121,10 +122,19 @@ jobs:
121122
- name: Run Pylint
122123
run: make check-lint
123124

125+
# Run pytest (backends subdirectory)
124126
- name: Run Pytest
127+
if: (matrix.subset == 'backends')
125128
run: |
126129
echo "SMARTSIM_LOG_LEVEL=debug" >> $GITHUB_ENV
127-
py.test -s --import-mode=importlib -o log_cli=true --cov=$(smart site) --cov-report=xml --cov-config=./tests/test_configs/cov/local_cov.cfg --ignore=tests/full_wlm/ ./tests/
130+
py.test -s --import-mode=importlib -o log_cli=true --cov=$(smart site) --cov-report=xml --cov-config=./tests/test_configs/cov/local_cov.cfg --ignore=tests/full_wlm/ ./tests/backends
131+
132+
# Run pytest (test subsets)
133+
- name: Run Pytest
134+
if: "!contains(matrix.subset, 'backends')" # if not running backend tests
135+
run: |
136+
echo "SMARTSIM_LOG_LEVEL=debug" >> $GITHUB_ENV
137+
py.test -s --import-mode=importlib -o log_cli=true --cov=$(smart site) --cov-report=xml --cov-config=./tests/test_configs/cov/local_cov.cfg --ignore=tests/full_wlm/ -m ${{ matrix.subset }} ./tests
128138
129139
# Upload artifacts on failure, ignoring binary files
130140
- name: Upload Artifact
@@ -143,5 +153,5 @@ jobs:
143153
- name: Upload Pytest coverage to Codecov
144154
uses: codecov/codecov-action@v2
145155
with:
146-
fail_ci_if_error: true
156+
fail_ci_if_error: false
147157
files: ./coverage.xml

doc/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ To be released at some future point in time
1919

2020
Description
2121

22+
- Split tests into groups for parallel execution in CI/CD pipeline
2223
- Change signature of `Experiment.summary()`
2324
- Expose first_device parameter for scripts, functions, models
2425
- Added support for MINBATCHTIMEOUT in model execution
@@ -27,6 +28,7 @@ Description
2728

2829
Detailed Notes
2930

31+
- Split tests into `group_a`, `group_b`, `slow_tests` for parallel execution in CI/CD pipeline (PR417_)
3032
- Change `format` argument to `style` in `Experiment.summary()`, this is
3133
an API break (PR391_)
3234
- Added support for first_device parameter for scripts, functions,
@@ -43,6 +45,7 @@ Detailed Notes
4345
- Add support for creation of multiple databases with unique identifiers. (PR342_)
4446

4547

48+
.. _PR417: https://github.com/CrayLabs/SmartSim/pull/417
4649
.. _PR391: https://github.com/CrayLabs/SmartSim/pull/391
4750
.. _PR342: https://github.com/CrayLabs/SmartSim/pull/342
4851
.. _PR394: https://github.com/CrayLabs/SmartSim/pull/394

tests/test_alps_settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
from smartsim.error import SSUnsupportedError
3131
from smartsim.settings import AprunSettings
3232

33+
# The tests in this file belong to the group_a group
34+
pytestmark = pytest.mark.group_a
35+
3336

3437
def test_aprun_settings():
3538
settings = AprunSettings("python")

tests/test_batch_settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
from smartsim.settings import BsubBatchSettings, QsubBatchSettings, SbatchSettings
3131
from smartsim.settings.settings import create_batch_settings
3232

33+
# The tests in this file belong to the group_a group
34+
pytestmark = pytest.mark.group_a
35+
3336

3437
def test_create_pbs_batch():
3538
pbs_batch = create_batch_settings(

tests/test_buildenv.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
from smartsim._core._install.buildenv import Version_
3131
from pkg_resources import packaging # type: ignore
3232

33+
# The tests in this file belong to the group_a group
34+
pytestmark = pytest.mark.group_a
35+
3336

3437
def test_version_hash_eq():
3538
"""Ensure hashes are equal if data is equal"""

tests/test_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
configure_parser as validate_parser,
4646
)
4747

48+
# The tests in this file belong to the group_a group
49+
pytestmark = pytest.mark.group_a
50+
51+
4852
def mock_execute_custom(msg: str = None, good: bool = True) -> int:
4953
retval = 0 if good else 1
5054
print(msg)

tests/test_cobalt_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27+
import pytest
2728

2829
from smartsim._core.launcher.cobalt import cobaltParser
2930

31+
# The tests in this file belong to the group_a group
32+
pytestmark = pytest.mark.group_a
33+
3034

3135
def test_parse_step_id():
3236
output = "JobName JobId \n" "=====================\n" "smartsim 507975 \n"

tests/test_colo_model_local.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
from smartsim.error import SSUnsupportedError
3333
from smartsim.entity import Model
3434

35+
# The tests in this file belong to the slow_tests group
36+
pytestmark = pytest.mark.slow_tests
37+
38+
3539
if sys.platform == "darwin":
3640
supported_dbs = ["tcp", "deprecated"]
3741
else:

tests/test_colo_model_lsf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
import smartsim.settings.base
3434
from smartsim.settings.lsfSettings import JsrunSettings
3535

36+
# The tests in this file belong to the group_a group
37+
pytestmark = pytest.mark.group_a
38+
3639

3740
is_mac = sys.platform == "darwin"
3841

tests/test_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
from pathlib import Path
2929

3030
import os
31-
from re import A, L
3231
import pytest
33-
import shutil
3432
import typing as t
3533

3634
from smartsim._core.config.config import Config
3735
from smartsim.error import SSConfigError
3836

37+
# The tests in this file belong to the group_a group
38+
pytestmark = pytest.mark.group_a
39+
3940

4041
def test_all_config_defaults():
4142
config = Config()

0 commit comments

Comments
 (0)