Repository navigation
ci(sentry): Run 8 sentry shards on API changes - #8772
Draft
sentry-junior[bot] wants to merge 4 commits into
Draft
sentry-junior[bot] wants to merge 4 commits into
sentry-junior[bot] wants to merge 4 commits into
Conversation
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
joshuarli
added a commit
to getsentry/sentry
that referenced
this pull request
Dec 2, 2026
…an (#133153) Snuba's CI runs Sentry's tests filtered with `-m 'snuba_ci or snuba'` (or `-m snuba_ci`) and `-k 'not __In'`. When `-m`/`-k` is present, `pytest-selected.py` skips the per-file plan, so every shard, and every xdist worker in it, collects the whole Sentry suite before keeping its hash share. In Snuba's API-change runs that collection takes about 6–7 minutes of every shard, and adding shards doesn't shrink it. The fallback exists because a filter can leave some shards with no selected tests. This adds an opt-in, `PYTEST_SELECTED_FILTERED_PLAN=1`, for callers that accept that: - Filtered full runs use the same `plan_full_shards` plan as unfiltered ones. Every candidate file still goes to a shard, including files missing from the durations, so no file is dropped. Pytest then applies `-m`/`-k` to the files it collects, so marker inheritance, parametrization, and hook-added markers behave as before. - A filtered shard whose files have no selected tests exits 0 instead of 5. Unfiltered shards with no tests still fail. - Without the variable, filtered runs keep today's behavior. Snuba turns this on in getsentry/snuba#8772. **Known limit:** balancing still uses the full backend durations, so a filtered run's selected tests can spread unevenly across shards. Snuba-specific weights are a follow-up only if the measured slowest shard shows it. <!-- junior-request-attribution:start --> via @joshuarli. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3ACLTE78L73%3A1796171061.177189 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3ACLTE78L73%3A1796171061.177189) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3ACLTE78L73%3A1796171061.177189/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
This was referenced Dec 2, 2026
Contributor
Author
|
Results from #8773 (8 shards) and #8774 (4 shards). Both force the API-change path ( Selection equivalence (job): one full collection vs. the union of the planned shards, by node ID, on the same checkout.
The real Timings (minutes per
This PR keeps 8 shards. Each experiment is one run, so expect a minute or so of runner noise. |
This branch has not been deployed
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.
On API changes the
sentryjob runs thesnuba_ci or snubatests across 4 shards of 17–19 minutes each. About 6–7 minutes of every shard goes to collecting the whole Sentry suite, which more shards don't shrink.sentryshards instead of 4. Runs without API changes keep 2.sentryjob setsPYTEST_SELECTED_FILTERED_PLAN=1(from ci(tests): Let filtered pytest-selected runs opt into the per-file plan sentry#133153), so each shard collects only its planned Sentry test files and-mpicks the tests in them. This applies to runs without API changes too.Sentry shards selected testsjob, required throughRequired checks, fails when any shard's report is missing, when the shards together select no tests, or when a test runs in two shards. Each shard uploads its pytest JSON report for it.Why 8 shards and not 4: with collection gone, 4 shards are still bound by test execution and stay well above the 8-minute target. 8 shards cost more runner time than 4, but less than today's full collection. The comparison has the numbers.
via @joshuarli.
--
View Session [Sentry]