Shard CI tests across 4 parallel jobs per backend to reduce wall-clock time#2864
Open
laxmareddyp wants to merge 2 commits into
Open
Shard CI tests across 4 parallel jobs per backend to reduce wall-clock time#2864laxmareddyp wants to merge 2 commits into
laxmareddyp wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds the pytest-shard package to the common requirements. The review feedback correctly points out that pytest-shard is unmaintained and has compatibility issues with newer versions of pytest, suggesting pytest-split as a more modern and actively maintained alternative.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
Following up on #2856 which brought CI test time from 6+ hours to ~20 min by switching to self-hosted runners and adding pytest-xdist parallelization, this PR adds test sharding to further reduce wall-clock time.
Changes
.github/workflows/actions.yml
Add shard: [0, 1, 2, 3] to the test matrix — each backend (TF, JAX, Torch) now spawns 4 parallel jobs, each running ~25% of the test suite using pytest-shard
Each shard still uses -n auto (pytest-xdist) internally for core-level parallelism within the job
Integration tests run only on shard 0 to avoid duplicate execution
Special version jobs (keras-3.15, keras-nightly, openvino) run as single un-sharded jobs (already fast enough)
requirements-common.txt
Add pytest-shard dependency for --shard-id / --num-shards support
Reference
Colab Notebook
Checklist