Repository navigation
[doc] Move Ray LLM docs into per-library llm/ directories and own them by glob - #66884
dstrodtman wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request reorganizes the directory structure of the LLM documentation and executable examples, moving them from doc/source/llm/ to more appropriate locations under doc/source/data/examples/llm/ and doc/source/serve/llm/doc_code/. It updates all associated references, including Buildkite test rules, GitHub CODEOWNERS, Dockerfiles, Bazel build configurations, documentation files, and redirects. There are no review comments to address, and the changes appear to be clean and complete.
dbedda8 to
eed6698
Compare
…e ones a Dockerfile downloads (#66964) ## Why are these changes needed? Some scripts under `doc/source/serve/doc_code/` aren't shown on any docs page, and some are tested but read by no reader. Docs example code should either appear on a page, be a test wrapper for content that does, or be deleted. This PR applies that rule to the Serve and Serve LLM `doc_code` trees: | File | Status before | Change | | --- | --- | --- | | `test_service_pb2.py`, `test_service_pb2_grpc.py` | Run by the serve test glob. No page includes them, and nothing outside this pair imports them. The gRPC guide uses `grpc_proxy/user_defined_protos_pb2*.py` instead. | Deleted | | `vllm_example.py` | Excluded from tests. No page includes it. `custom-vllm.md` uses `custom_vllm_example.py`. | Deleted, along with its entry in the serve `exclude` list in `doc/BUILD.bazel` | | `llm/doc_code/serve/sglang/sglang_batch_example.py` | Excluded from tests by the `sglang/**` glob. No page includes it. The SGLang guide shows the serving, query, and multinode scripts. | Deleted. The other three SGLang scripts still match the exclude glob, so `doc/BUILD.bazel` doesn't change for this one. | | `whisper_example.py`, `resnet50_example.py` | `multi-app-container.md` downloads both in its Dockerfiles with `curl` from `raw.githubusercontent.com/ray-project/ray/master/...`. Whisper wasn't shown on any page. | Shown on the page with `literalinclude`. Each script now has a comment naming the page that depends on its path, so a rename or a move of `serve/doc_code/` doesn't break the Dockerfiles silently. | The Dockerfiles keep the raw URL, so the guide's procedure doesn't change. `resnet50_example.py` already uses `__serve_example_begin__` and `__serve_example_end__` markers for the autoscaling guide, and `whisper_example.py` gains the same markers. #66884 moves `llm/doc_code/serve/sglang/` to `serve/llm/doc_code/sglang/`. If this PR merges first, #66884 needs a rebase that drops its rename of `sglang_batch_example.py`. ## Related issue number None. No open issue or PR covers these files. I searched open PRs for each filename and checked my own open PRs. #66884 is the only overlap. It renames `sglang_batch_example.py`, which this PR deletes. ## Checks - [x] I've signed off every commit (DCO). - [x] `pre-commit run --files <changed files>`: passed, including buildifier and the master-link check. - [x] `python -m py_compile` on the two edited scripts: passed. - [x] `git grep` for `test_service_pb2`, `serve/doc_code/vllm_example`, and `sglang_batch_example`: no remaining references. - [ ] I didn't run a local Sphinx build. The Read the Docs preview validates the two new `literalinclude` blocks. AI assistance (Claude Code) was used to prepare this PR. I reviewed every changed line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
be89fea to
29cc273
Compare
…per-page doctest targets (#67204) ## Why are these changes needed? Several contributor-facing CI docs fell behind the docs CI changes that merged this month. - **`ci.md`, "Docstring-only changes."** The section still described `data: docstring examples` and said the examples step covers Ray Data only. Since #67083, `doc: docstring examples` in `others.rayci.yml` runs the changed modules' `>>>` examples for every library that a CPU `doctest()` target covers. It runs in the light `docstringbuild` image, which has no torch or TensorFlow, and reports examples that need those libraries as skipped, by name. Since #67341, the label also skips every library's test suites through `.buildkite/docs.labels.yaml`, so the section now says that, and recommends an `@rtd-build` commit line alongside the label so Read the Docs builds the API reference the docstrings render into. - **`ci.md`, broken steps and post-merge builds.** A new "Why some steps show as broken" section says that on a PR the label rules remove the steps a label skips, so they don't appear at all, that the scope guard is the one label-gated step still shown as `broken` on an unlabeled PR, and that scheduled post-merge builds don't apply label rules, so all three label-gated steps show as `broken` there. The page also distinguishes the two kinds of post-merge build on `master`. The build each merge starts doesn't run the docs example tests, and the scheduled builds that the release automation triggers run the full suite, so the page now says "scheduled post-merge builds" wherever it means those. - **`writing-code-snippets.md`, "How to test examples with GPUs."** It told readers to open `doc/BUILD` and exclude their page from a `glob(["source/**/*.rst"])` catch-all target. Neither exists: #66809 and #67003 replaced library-wide prose targets with per-page `doctest_each()` lists. The steps now show both cases: a doc page moves from its library's `doctest_each` list to the GPU `doctest` rule, and a docstring module moves from the CPU glob's `exclude` to the GPU rule. A new short section says how a page with its first runnable example joins CI, which the `doc_prose_doctest_targets` lint enforces. - **`docs.md` and `writing-style.md`.** Both said CI enforces Vale. The `documentation_style` check is out of the `lint.rayci.yml` matrix for now, so they say the check is temporarily off. - **`ci/ray_ci/doc/README.md`.** It described only the doc build and the API guard. It now covers the scripts behind the `docs-example-test` and `docstring-only` labels and `linkcheck_report.py`. - **`doc/README.md`.** It said CI doesn't run linkcheck. The postmerge `doc: linkcheck` step does, as a soft-fail step that never blocks. Docs-only. No CI or behavior changes. ## Related issue number None. Follows #66806, #66809, #66814, #67003, and #67083. ## Duplicate check Not a duplicate. `gh pr list --repo ray-project/ray --state open` searches for `"ci.md docstring"`, `"writing-code-snippets"`, and `"ci/ray_ci/doc README"` return two other open PRs that touch these files, both mine, neither covering these sections: - #65868 adds a "How to test a Ray Serve deployment" section to `writing-code-snippets.md` at the same insertion point as this PR's new section, so whichever merges second needs a trivial rebase. - #66884 updates the LLM doc paths in `ci.md`, not the docstring-only section. ## Testing - Every changed claim was checked against `master` at 3ae1b8b: `.buildkite/others.rayci.yml`, `.buildkite/data.rayci.yml`, `.buildkite/lint.rayci.yml`, `.buildkite/doc.rayci.yml`, `doc/BUILD.bazel`, `python/ray/train/BUILD.bazel` (the GPU rule examples are copied from the real `doctest[train-gpu]` and `py_doctest[train-gpu]` rules), `doc/test_prose_doctest_targets.py`, and the scripts under `ci/ray_ci/doc/`. - `pre-commit run` on the changed files passes, including the master-link check. - Not run: a Sphinx build. The Read the Docs preview on this PR is the check. AI assistance (Claude Code) was used to find the stale text and draft the changes. I reviewed every changed line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
doc/source/llm/ had no index page and no toctree entry. Move the two Ray Data batch-inference notebooks to doc/source/data/examples/llm/ and the Ray Serve LLM example code to doc/source/serve/llm/doc_code/, next to the pages that use them. Update the literalinclude paths, Bazel targets, custom vLLM plugin image, CI routing rules, and CODEOWNERS, and redirect the old notebook URLs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Move data/working-with-llms.md and its doc_code into data/llm/, so all Ray LLM docs live in an llm/ directory under a library's docs. Replace the per-path LLM CODEOWNERS entries and CI routing lines with globs on that convention, give ray-llm the llm API reference pages, and redirect the guide's old URL. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
29cc273 to
82b9474
Compare
jeffreywang88
left a comment
There was a problem hiding this comment.
can you verify the doc builds and code snippets in the doc show up correctly?
|
@jeffreywang88 Verified against the RtD preview: the build passes, and I compared every code block on the 15 affected pages against master. All match exactly, including all 45 snippets in the Data LLM guide, whose |
#67012) ## Why are these changes needed? Ray's docs are retiring notebooks and the `doc_code` scripts that no page shows. This PR adds a guard so that debt can't grow back while it's being burned down. It follows the shape of `doc/test_no_new_rst.py`. `doc/test_doc_assets.py` checks the tracked tree, not the diff, and fails in three cases: 1. **A new notebook.** Any `.ipynb` under `doc/source/` that isn't on `doc/asset_allowlists/notebooks.txt`. 2. **A `doc_code` script that no page shows.** A `.py` under `doc/source/**/doc_code/` counts as shown if any of these holds: - A page pulls it in with `literalinclude` or `include`. RST and MyST forms both count, as do relative and `/`-rooted paths. - A shown script imports it, transitively. - It's a test wrapper. That means it imports an included script, or it names an included file in a string literal. The second form covers the `llm/doc_code/serve/**/*_yaml_config_example.py` scripts that load and deploy an included YAML config, so they need no permanent exemption. Anything else has to be on `doc/asset_allowlists/doc_code.txt`. 3. **A stale allowlist entry.** A listed file that's gone, or that a page now shows, also fails, so both lists only shrink. Each conversion or cleanup PR deletes its own lines. `python doc/test_doc_assets.py --update` rewrites both lists from the tree. It's there for re-seeding after a rebase. The contributor docs say not to use it to get a new file through. ### Seeded debt at this commit - 52 notebooks. - 10 unshown `doc_code` scripts. Two open PRs clear 7 of them: #66964 handles 5 Serve and LLM scripts, and #66965 handles the 2 RLlib scripts. If either merges first, this PR re-seeds with `--update`. If either merges after this one, it deletes its own allowlist lines. The scripts with no open PR are `cluster/doc_code/simple-trainer.py` (run by the included `slurm-basic.sh`, never shown), `cluster/doc_code/yarn/dashboard.py`, and `llm/doc_code/serve/custom_vllm/qwen3_reward_plugin/qwen3_rm.py` (linked on GitHub, not included). ### Where it runs: a lint matrix entry, not a `py_test` The check runs as `lint: doc_assets` in the `lint-small-prose` matrix next to `doc_no_new_rst`. It doesn't run as a Bazel `py_test`, for two reasons: - A prose-only change can fail it. Deleting a page's last `literalinclude` of a script orphans that script. That step keeps the `always` tag, so it runs on every PR, including prose-only ones. A `doc`-tagged test would miss them. - It reads the whole `doc/source/` tree. As a `py_test`, it would need all of `doc/source/` as `data` to get into the Bazel sandbox. It runs postmerge as well, because non-PR builds run everything. **REEf: please confirm this placement, the premerge gating, and the rule changes below.** ### Routing - `doc/test_doc_assets.py` joins `doc/test_no_new_rst.py` in the `doc` build-infra rule in `test.rules.txt`. Without that, it falls to the `doc/*.py` catch-all and emits `doc_example`. - The allowlists route to nothing in `test.rules.txt`. Only the lint step reads them, and that step runs on every PR. They get `always lint` from the `always.rules.txt` catch-all. - Expectations for both paths are added to `test.rules.test.txt` and `always.rules.test.txt`. ### Limits - The check doesn't apply Sphinx `exclude_patterns`, so a page excluded from the build still counts as showing what it includes. At this commit, honoring the excludes changes nothing. - `doc/source/ray-contribute/docs.md` still describes authoring notebooks. Rewriting it is separate work, which removes the notebook template and replaces that guidance. Until then, the check's failure message points to the new section in `ci.md`. ## Related issue number None. Before opening this PR, I searched open PRs for notebook, allowlist, `doc_code`, and orphan keywords and found no other ratchet. #66964, #66965, #67008, and #66884 shrink or move the seeded debt, and none of them adds a check. #64053 adds a new Serve example plus a test that names the example script by filename. The test-wrapper rule passes it, provided its page includes the example script. ## Checks - [x] I've signed off every commit (DCO). - [x] `./ci/lint/lint.sh doc_assets`: passes on this branch with the seeded lists. - [x] Each failure mode, exercised locally and then reverted: a new `.ipynb` fails, a new unshown `doc_code` script fails, removing a page's `literalinclude` fails along with the scripts that only it imported, a stale allowlist line fails, and a test script that imports an included script passes. - [x] `--update` is idempotent on this tree. - [x] `rayci test-rules`, built from `ray-project/rayci` master: all rule tests pass, including the new expectations. - [x] `pre-commit run` on the changed files: passed, including black and ruff. - [x] Cross-checked the seed against an independent scan of the same tree. It lists the same 9 scripts, and also flags `test_service_pb2.py`, which only an unshown script imports. #66964 deletes both of those `pb2` scripts. AI assistance (Claude Code) was used to prepare this PR. I reviewed every changed line. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…llm-dir Signed-off-by: Douglas Strodtman <[email protected]> # Conflicts: # ci/docker/custom-vllm-plugin.build.Dockerfile # ci/docker/custom-vllm-plugin.build.wanda.yaml # doc/BUILD.bazel # doc/source/data/examples/llm/BUILD.bazel
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 11224a8. Configure here.
#67525 moved the Ray LLM docs examples off GPU CI and into the nightly llm_doc_tests release test on H100s. ci.md still said the scheduled post-merge builds run them, and listed a Ray LLM GPU docs step that no longer exists. Signed-off-by: Douglas Strodtman <[email protected]>
|
@jeffreywang88, this PR now overlaps with your #67525, which moved the LLM docs examples to the
The same examples run as before, but the paths change. I haven't run the release test itself, so a nightly run, or a manual one on this branch, would confirm it. |
#67525 moved the Ray LLM docs examples off Bazel GPU targets and into the nightly llm_doc_tests release tests, and deleted the batch notebooks' BUILD.bazel. The doc/source/*/llm/*BUILD.bazel rule and its expectation described a file that no longer exists by design, and the rules comments still said the postmerge build runs these examples. - Remove the llm BUILD.bazel rule and its test.rules.test.txt expectation. - Say in both rules comments that the llm_doc_tests release tests run them. - Point the GPU-target fixture in test_doc_example_targets.py at a real Ray Data GPU notebook target instead of the removed LLM one. Signed-off-by: Douglas Strodtman <[email protected]>
Only the custom vLLM doc example Bazel target carried this tag, and #67525 deleted that target when it moved the LLM docs examples to the nightly llm_doc_tests release tests. No target uses the tag now. Signed-off-by: Douglas Strodtman <[email protected]>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |

Description
Ray LLM is one codebase, owned by
ray-llm, that ships through two libraries, Ray Data and Ray Serve. Its docs assets used to sit in a top-leveldoc/source/llm/directory that matched that ownership: one path for CODEOWNERS, CI routing, and test tags. But docs are organized by library, so the directory had no page and no toctree entry, and its assets sat away from the pages that include them. The Data LLM guide and its code lived outside it anyway, so ownership and routing still listed paths one by one.This PR keeps single-team ownership but moves it from a directory to a convention: Ray LLM docs live in an
llm/directory under the library they document. Assets sit next to their pages, and CODEOWNERS and CI routing each become one glob that also covers future LLM docs. The top-leveldoc/source/llm/directory is gone:doc/source/llm/examples/batch/(2 notebooks)doc/source/data/examples/llm/doc/source/llm/doc_code/serve/(25 files)doc/source/serve/llm/doc_code/doc/source/data/working-with-llms.mddoc/source/data/llm/working-with-llms.mddoc/source/data/doc_code/working-with-llms/(11 files)doc/source/data/llm/doc_code/The moved files have no content edits apart from the path references that move with them, and git detects all 39 as renames. The
doc_code/moves keep the same directory depth, so relative paths inside the code don't change. The one page whose depth changed, the Data LLM guide, has its 40literalincludepaths rebased.Related issues
None.
Additional information
Ownership and CI routing by convention
/doc/source/**/llm/covers everyllm/directory./doc/source/**/api/llm.*covers theray.data.llmandray.serve.llmAPI reference pages. Neither page hadray-llmas an owner before, even thoughray-llmowns the code both pages document. The removed per-path entries included/doc/source/data/working-with-llms.rst, which no longer matched any file because the page is now.md..buildkite/test.rules.txt, the LLM docs rules become one pattern on the convention.doc/source/*/llm/*is a skip rule: every LLM docs example needs a GPU, docs examples never run GPU tests in premerge or microcheck, and the nightlyllm_doc_testsrelease test runs them on H100s throughdoc/test_llm_examples.py. That matches how master already treats LLM doc assets. Master's separatellmrule for the batch notebooks'BUILD.bazelis gone, because [ci][llm] Migrate LLM tests to the reserved H100 cluster #67525 deleted that file and LLM doc examples are no longer Bazel targets.raycitreats*as matching across/, so the pattern covers everyllm/directory at any depth. It sits ahead of the per-library doc rules, and Data LLM guide prose still reachesdoc_examplethrough the earlier doc prose rule..buildkite/test.rules.test.txtrecords an expectation for each of the three asset directories.doc/AGENTS.mdandray-contribute/ci.mdnow describe thellm/convention instead of naming the old directory. A fixture inci/ray_ci/doc/test_doc_example_targets.pythat used the old LLM notebook target as its example GPU target now uses a real Ray Data GPU notebook target, since the LLM one no longer exists.GPU_TAGSinci/ray_ci/doc/doc_example_targets.pyalso dropscustom_vllm_plugin, a tag that only the target [ci][llm] Migrate LLM tests to the reserved H100 cluster #67525 deleted carried.ci.mdalso had two sentences that [ci][llm] Migrate LLM tests to the reserved H100 cluster #67525 made stale. It said the scheduled post-merge builds run the LLM GPU docs examples, and it listed a Ray LLM GPU docs step. Both now reflect the nightlyllm_doc_testsrelease test, which runs the LLM examples on H100s.Other path updates
literalincludepaths in the Serve LLM pages and the Data LLM guide, the Data user guide toctree, the{doc}link to the LoRA example, the two gallery links indata/examples.yml, and a GitHub source link inserve/llm/user-guides/custom-vllm.md.{ref}links to the guide'sworking-with-llmslabel are filename-independent and unchanged.llm_doc_testsrelease test on H100s. That replaced the per-directory GPU targets and the batch notebooks' ownBUILD.bazel. This PR points that setup at the new paths: thellm_doc_testsfilegroup globs indoc/BUILD.bazel, the example list indoc/test_llm_examples.py, the custom vLLM plugin'spip installpath inrelease/release_tests.yaml, and the notebook anddoc_codeentries indoc/asset_allowlists/. The same examples run as before.python/ray/llm/examples/sglang/readme.mdnames the path of the multi-node example's doc copy.Redirects
Two
pagerules indoc/redirects/current.yaml:No existing rule pointed at or from either old path, so there's nothing to repoint. The
doc_code/files aren't rendered pages, so they need no redirect.Verification
This branch was merged with master on 2026-11-03, after master moved the LLM doc tests to the release H100 cluster. The
test.rules, pytest, path, and asset checks below ran after that merge. The redirect, build, and CODEOWNERS checks ran before it, and this PR's CI covers the merged build.rtd-redirects validate doc/redirects/current.yaml: 0 errors, 0 warnings, 183 chain notes. The counts are the same as on master.rtd-redirects simulatewith--prefix /llm/ --prefix /data/working-with-llms --git-renames doc/source, run against master (the local build as the after side), latest,releases-2.50.0, andreleases-2.40.0: 0 regressions, 0 wrong landings, and 0 new loops on every version. On master, all three old URLs reach their new pages in 1 hop. On latest and the older releases the old pages still exist or never existed, so the rules don't fire.make -C doc rtd-build, which is the RtD-faithful clean build with-W:build succeeded.with exit 0.sphinx_fix.pyreports no actionable warnings..buildkite/test.rules.test.txt:rayci test-rulespasses every expectation. A deliberately wrong expectation fordoc/source/data/llm/doc_code/fails it, so the run exercises the new rules.pytest ci/ray_ci/doc/test_doc_example_targets.pypasses. Every path indoc/test_llm_examples.pyexists, anddoc/test_doc_assets.pypasses.codeowners/errorsAPI reports no errors on the new lines. The two errors it does report, an unknown owner on the Azure autoscaler lines, are already on master.🤖 Generated with Claude Code