From 6b0f80ae0e26703b1e7939b95a093a0c425d93af Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Thu, 12 Nov 2026 03:45:17 -0800 Subject: [PATCH] ci: run slowest examples first - sort sagehen, rotate, uzt-2d, hecht-mendez to the front of the collection so they don't straggle at the end of parallel runs - use --dist=worksteal so idle workers pick up queued tests Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ex-workflow.yml | 4 ++-- autotest/conftest.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ex-workflow.yml b/.github/workflows/ex-workflow.yml index e5338cf4..fb4dcbe4 100644 --- a/.github/workflows/ex-workflow.yml +++ b/.github/workflows/ex-workflow.yml @@ -95,7 +95,7 @@ jobs: - name: Create example models working-directory: modflow6-examples/autotest # run the scripts via pytest without running the models, just build input files - run: pixi run pytest -v -n=auto --durations=0 test_scripts.py --init + run: pixi run pytest -v -n=auto --dist=worksteal --durations=0 test_scripts.py --init - name: Make zipfile working-directory: modflow6-examples @@ -184,7 +184,7 @@ jobs: - name: Run examples, make plots working-directory: modflow6-examples/autotest - run: pixi run pytest -v -n=auto --durations=0 test_scripts.py --plot + run: pixi run pytest -v -n=auto --dist=worksteal --durations=0 test_scripts.py --plot - name: Run postprocessing working-directory: modflow6-examples/scripts diff --git a/autotest/conftest.py b/autotest/conftest.py index 476edf08..039d08d1 100644 --- a/autotest/conftest.py +++ b/autotest/conftest.py @@ -8,6 +8,8 @@ pytest_plugins = ["modflow_devtools.fixtures", "modflow_devtools.snapshots"] EXCLUDE = [] +# slowest first, so they don't straggle at the end of parallel runs +SLOW = ["ex-gwf-sagehen", "ex-gwt-rotate", "ex-gwt-uzt-2d", "ex-gwt-hecht-mendez"] PROJ_ROOT = Path(__file__).parents[1] SCRIPTS_PATH = PROJ_ROOT / "scripts" TABLES_PATH = PROJ_ROOT / "tables" @@ -157,3 +159,13 @@ def pytest_generate_tests(metafunc): if file.stem not in EXCLUDE } metafunc.parametrize("example_script", scripts.values(), ids=scripts.keys()) + + +def pytest_collection_modifyitems(items): + def rank(item): + for i, name in enumerate(SLOW): + if f"[{name}.py]" in item.nodeid: + return i + return len(SLOW) + + items.sort(key=rank)