Repository navigation
Backend CI: run test_diffusion* in its own pytest shard - #17723
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
added a commit
that referenced
this pull request
Nov 14, 2026
…nt the diffusion shard (#17736) ## Summary Follow-up to #17723, which moved `test_diffusion*` into its own `(Python 3.13, diffusion)` backend shard. Two things went red once that shard ran (seen on a staging run against current main): 1. `Repo tests (CPU, studio)` and `workflow-trigger lint`: ``` tests/studio/test_backend_ci_parallel_isolation.py::test_the_command_scan_sees_the_parallel_run_and_the_serial_steps AssertionError: expected fourteen parallel pytest runs, four shards of the backend matrix and ten of repo-cpu-tests ... assert 15 == 14 ``` That test pins the number of parallel pytest runs on purpose, so a new shard has to be stated there. #17723 updated `test_ci_backend_pytest_shards.py` but missed this one. My mistake. 2. `(Python 3.13, diffusion)`: five tests in `studio/backend/tests/test_diffusion_lm_studio.py` fail with `PackageNotFoundError: No package metadata was found for unsloth_zoo`: - `test_frame_relay_throttles_and_never_raises_into_the_sampler` - `test_frame_relay_sends_zero_based_steps_and_honours_stop_sequences` - `test_frame_relay_cuts_frames_at_the_first_eos` - `test_diffusion_eos_ids_match_the_sampler_cut` - `test_chat_diffusion_load_refuses_an_unmarked_model_and_keeps_the_token_boundary` They import `core.inference.inference`, which imports `unsloth`, and the backend job installs neither `unsloth_zoo` nor `trl`. They only passed in the old a-f shard because an earlier file on the same worker (`test_audio_chat_load.py`, `test_chat_prompt_bos.py`) had already imported that module with its own `unsloth` stubs and left it cached. In a shard of only `test_diffusion*` files that never happens. So these tests have depended on xdist scheduling since #13593; the split only made it deterministic. ## Change - `tests/studio/test_backend_ci_parallel_isolation.py`: 15 parallel runs, 5 backend shards. - `studio/backend/tests/test_diffusion_lm_studio.py`: a small `inference_mod` fixture the five tests now take. - When `unsloth_zoo` is installed, or the module is already imported, it returns the real module. Nothing changes there. - Otherwise it stubs `unsloth` and `unsloth.chat_templates` (the same two names the other backend tests stub) through `monkeypatch`, and also drops the freshly imported `core.inference.inference`. So no later test inherits a module bound to these stubs. - The tests keep running in the backend job instead of being skipped there. ## Testing - Locally, with `diffusers`, `unsloth_zoo` and `trl` hidden from import (the backend job's environment): `test_diffusion_lm_studio.py`, `test_diffusion_int8_attention.py` and `test_diffusion_rocm_tag_detect.py` on their own. The five tests fail on main with the same error and pass here. They also pass with the real packages installed. - The same files in one process, before and after `test_audio_chat_load.py` and `test_chat_prompt_bos.py`: 78 passed, 33 skipped in both orders. - Every test that reads `studio-backend-ci.yml` (15 files): 341 passed, 3 skipped. The isolation test fails on main. - `test_backend_tests_stub_heavy_imports.py` and `test_sibling_imported_tests_import_their_helpers_top_level.py`: pass. The other failures on the new shard come from #17718 and are fixed in #17737.
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.
Summary
The Backend CI
(Python 3.13, a-f)shard is now running into itstimeout --signal=INT --kill-after=60 1500backstop. On #17694 (a Studio download-registry change) the parallel step was killed with exit 124 after30296 passed ... in 1509.42s, before it finished. Its other recent runs took 1000 to 1340 s, so any slower runner tips it over.This is the same situation as a-k on 2026-10-23 and g-r on 2026-11-09, and it gets the same fix: split the shard, leave the timeout alone (it is a hang backstop, not a budget).
How the split point was chosen
Same method as #17187: the
-qprogress lines carry timestamps, and xdist hands out tests roughly in collection order, so I mapped the progress percentage onto the per-file collection order of a-f. Across five a-f logs (four complete, one killed):test_c*test_diffusion*startstest_diffusion*endstest_d*alone is about 65% of the shard and nearly all of it istest_diffusion*(about 60%). No first letter split comes close to even, sotest_diffusion*gets its own shard: roughly 40% stays in a-f and 60% moves.Changes
.github/workflows/studio-backend-ci.yml:a-falso ignorestests/test_diffusion*.py.diffusionshard, rooted attests/like the others (so the shared--ignore=list still applies). It excludes everything buttest_diffusion*one letter at a time, sotest_diffusers*(and any othertest_d*file) stays ina-f.restis unchanged and still the remainder.a-f. The(Python 3.13, a-f)check keeps its name.tests/test_ci_backend_pytest_shards.py: new-file examples for the boundary (test_dog,test_diffusers_new,test_diffuseland ina-f;test_diffusion_new,test_diffusionland indiffusion).Testing
pytest tests/test_ci_backend_pytest_shards.py: 59 passed.test_diffusion*ignore ona-f, 3 tests fail (files run twice). Without thetest_diffus[!i]*step, the same 3 fail (test_diffusers*would run in both shards).pytest --collect-onlywith the CI selection and shared ignores: old a-f collects 38267 tests, new a-f 16230 and diffusion 22037. The two are disjoint and their union is identical to the old a-f node IDs.