Skip to content

Split slow tests into parallel 2D and 3D jobs - #11

Merged
derekthirstrup merged 1 commit into
mainfrom
claude/split-slow-tests-by-dim
May 7, 2026
Merged

derekthirstrup merged 1 commit into
mainfrom
claude/split-slow-tests-by-dim

Conversation

@derekthirstrup

Copy link
Copy Markdown
Owner

What does this PR do?

This PR optimizes CI performance by splitting the slow-tests workflow into two parallel jobs that run 2D and 3D tests separately, rather than running both in a single job. This halves the wall-clock time for the slow-tests workflow on push-to-main.

Changes:

  1. conftest.py: Extended the test filtering logic to support both CYTO_DL_SKIP_3D and CYTO_DL_SKIP_2D environment variables, allowing selective skipping of either 2D or 3D parametrized tests based on spatial dimensions.

  2. slow-tests.yml: Converted the single slow-test job into a matrix strategy with two parallel jobs:

    • One job runs 2D tests only (skips 3D)
    • One job runs 3D tests only (skips 2D)

    Each job is properly labeled and passes the appropriate skip flags via environment variables.

This approach maintains full test coverage while reducing CI execution time by running the expensive 3D tests in parallel with 2D tests.

Before submitting

  • Did you make sure title is self-explanatory and the description concisely explains the PR?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you test your PR locally with pytest command?
  • Did you run pre-commit hooks with pre-commit run -a command?

Breaking changes: None. The changes are backward compatible—existing behavior is preserved when neither skip flag is set.

Did you have fun?

Optimizing CI workflows is always satisfying! 🚀

https://claude.ai/code/session_01Fri5KfdBh8FT5szwJMojtW

The slow-tests run on push-to-main was hitting 30+ min because
free GitHub Linux runners only provide 2 CPUs (xdist '-n auto'
spawns 2 workers, not 4 as I'd projected).

Halve wall-time by running 2D and 3D as two separate parallel jobs:
- conftest.py: pytest_collection_modifyitems now honors both
  CYTO_DL_SKIP_3D=1 and CYTO_DL_SKIP_2D=1, mirroring each other.
  Either env var alone behaves as before; setting both would
  deselect everything (not used).
- slow-tests.yml: matrix.include with two entries (dims=2 and
  dims=3), each setting the opposite skip env var. Both jobs run
  on free runners in parallel, so the effective parallelism is
  2 jobs x 2 xdist workers = 4 workers across the matrix.

Expected wall-time: ~10-12 min per leg, ~12 min total (limited by
the slower 3D leg).

https://claude.ai/code/session_01Fri5KfdBh8FT5szwJMojtW
@derekthirstrup
derekthirstrup merged commit 91829e3 into main May 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants