Skip to content

[Docs][kubectl-plugin] Add kubectl-plugin examples for TPU worker groups - #65707

Open
markwu7 wants to merge 3 commits into
ray-project:masterfrom
markwu7:docs/kubectl-plugin-tpu
Open

markwu7 wants to merge 3 commits into
ray-project:masterfrom
markwu7:docs/kubectl-plugin-tpu

Conversation

@markwu7

@markwu7 markwu7 commented Aug 24, 2026

Copy link
Copy Markdown

Description

The kubectl plugin user guide only showed default kubectl ray create cluster flags and a --worker-replicas override. It did not show how --worker-tpu works with GKE node selectors and --num-of-hosts.

KubeRay now validates accelerator, topology, and host count against the GKE TPU table. Invalid combos fail at create time, such as 4x4 with the default --num-of-hosts 1.

Related issues

Follow-up of KubeRay PR (TPU accelerator / topology / numOfHosts validation)

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

@markwu7
markwu7 requested review from a team and andrewsykim as code owners August 24, 2026 19:25

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces documentation for creating TPU worker groups using the kubectl plugin, covering 2D and 3D TPU slice configurations, validation skipping, and deletion. The feedback points out that using angle brackets for placeholders in the shell command example will cause shell redirection errors, and suggests using uppercase placeholders instead.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Mark Wu <[email protected]>
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Aug 25, 2026
@markwu7

markwu7 commented Aug 30, 2026

Copy link
Copy Markdown
Author

cc @rueian @machichima @CheyuWu @andrewsykim PTAL!

@Kunchd

Kunchd commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@andrewsykim, could you guys take a look when available. Thanks!

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Sep 15, 2026

@ryanaoleary ryanaoleary left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM!!

@ryanaoleary

Copy link
Copy Markdown
Contributor

@dstrodtman @Kunchd for docs review/merge

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Sep 15, 2026

@dstrodtman dstrodtman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs review from Douglas Strodtman on the Anyscale docs team, drafted with Claude Code assistance; I've read every comment and stand behind each one.

Scope is style, grammar, and Ray docs conventions only. The technical content is the maintainers' call, and @andrewsykim and @ryanaoleary have already approved it. Two small prose suggestions inline against doc/source/ray-contribute/writing-style.md; both are optional and neither changes a technical claim.

One note on the earlier bot suggestion: Ray's style guide (§ "Use angle brackets for placeholders") asks for <accelerator>/<topology> rather than uppercase, so I've suggested reverting that one line back to angle brackets. See the inline comment for why the guide still applies to an illustrative text block.

The docs side has no objection to this merging. I'll leave the merge/stamp to you.


v4, v5p, and tpu7x use 3D topologies of the form `AxBxC`. The accelerator values are `tpu-v4-podslice`, `tpu-v5p-slice`, and `tpu7x`. These accelerators always use 4 TPUs per host, so `--worker-tpu` must be 4. Set `--num-of-hosts` to the product of the three dimensions divided by 4. Single-host 3D is `2x2x1`, not `1x1`.

The plugin also rejects invalid 3D shapes. `2x2x1` is a special case and always allowed. For topologies with 64 chips or fewer, each dimension must be even. Above 64 chips, each dimension must be multiples of 4, with `A <= B <= C` - for example, `8x4x4` has 128 chips but fails because `8 > 4`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small prose fixes. Ray's guide asks to restructure rather than join clauses with a dash in prose (§ Sentence structure: "Avoid dashes ... Restructure instead"), so this reads better as two sentences. And a number-agreement fix: "each dimension must be a multiple of 4." The AxBxC topology forms are dimensions, which the guide explicitly keeps as symbols, so those stay as-is.

Suggested change
The plugin also rejects invalid 3D shapes. `2x2x1` is a special case and always allowed. For topologies with 64 chips or fewer, each dimension must be even. Above 64 chips, each dimension must be multiples of 4, with `A <= B <= C` - for example, `8x4x4` has 128 chips but fails because `8 > 4`.
The plugin also rejects invalid 3D shapes. `2x2x1` is a special case and always allowed. For topologies with 64 chips or fewer, each dimension must be even. Above 64 chips, each dimension must be a multiple of 4, with `A <= B <= C`. For example, `8x4x4` has 128 chips but fails because `8 > 4`.

If GKE supports a TPU configuration that the plugin hasn't listed yet, pass `--skip-tpu-validation`. The plugin then skips accelerator, topology, and host-count checks.

```text
$ kubectl ray create cluster raycluster-tpu-sample-4 --worker-tpu 4 --num-of-hosts 4 --worker-node-selectors cloud.google.com/gke-tpu-accelerator=ACCELERATOR,cloud.google.com/gke-tpu-topology=TOPOLOGY --skip-tpu-validation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ray's style guide marks reader-replaced values with angle brackets, not uppercase (§ "Use angle brackets for placeholders": uppercase is ambiguous with real constants and environment variables). The earlier bot comment suggested uppercase because unquoted < and > act as shell redirection, but this is an illustrative text block showing a template rather than a command run verbatim, so the guide's angle-bracket convention applies here. Your call given you already responded to the bot.

Suggested change
$ kubectl ray create cluster raycluster-tpu-sample-4 --worker-tpu 4 --num-of-hosts 4 --worker-node-selectors cloud.google.com/gke-tpu-accelerator=ACCELERATOR,cloud.google.com/gke-tpu-topology=TOPOLOGY --skip-tpu-validation
$ kubectl ray create cluster raycluster-tpu-sample-4 --worker-tpu 4 --num-of-hosts 4 --worker-node-selectors cloud.google.com/gke-tpu-accelerator=<accelerator>,cloud.google.com/gke-tpu-topology=<topology> --skip-tpu-validation

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixed. PTAL!

@markwu7
markwu7 requested a review from a team as a code owner September 15, 2026 16:19
dstrodtman added a commit that referenced this pull request Oct 9, 2026
…t enforced) (#66885)

## Why are these changes needed?

This PR adds Vale terminology rules for Ray Train docs ahead of a style
pass over those pages. It follows the pattern from #65239 (KubeRay),
#66236 (RLlib), and #66640 (Ray Core). Every rule is warn-level and
**doesn't run in CI yet**. Registering the config lets contributors run
`vale doc/source/train/` by hand during the style pass.

**Stacked on #66883**, which renames the Train landing page and
hyphenates page slugs. The path-scoped section targets the final paths,
so this PR targets that branch. Retarget it to `master` once #66883
merges.

## What's here

- **`.vale/styles/Train/Terms.yml`:** case-sensitive `substitution`
swaps at `level: warning`, each safe to apply without judgment, so the
file sets `action: replace`. The forms follow the four concepts
`train/overview.md` defines:
  - `train function` becomes `training function`.
- `scaling config`, `run config`, and `checkpoint config` are spelled
out in prose. The classes keep code style.
  - `finetune` and its forms become `fine-tune`.
  - `Train v2` becomes `Train V2`.
- **`.vale/styles/Train/Capitalization.yml`:** title-cased generic
nouns, such as `Fault Tolerance`, `Local Mode`, and `Worker Group`, plus
`Trainer` written as the Ray Train concept. Applying any of these takes
judgment, so this rule has no replace action:
- Lowercasing would also drop the capital at the start of a heading or
sentence, which has to stay.
- A bare "Trainer" in prose is often a third-party class, such as the
Lightning or Hugging Face Transformers `Trainer`. Those need code style,
not lowercase. The rule's keys carry a preceding word, such as `the
Trainer` and `your Trainer`, and leave the decision to a person.
- **Trainer casing:** prose uses "trainer" lowercase for the concept,
with class names in code style. That matches the guide's rule to
lowercase generic nouns even when they name a Ray concept, the way Ray
Core treats "placement group." `overview.md` capitalizes it today, so
the style pass changes that page.
- **Accept lists:**
- `Train` gains `JAX`, `Flax`, `Optax`, `Orbax`, `TensorBoard`,
`torchrun`, `allreduce`, and `resharding`.
- `General` gains cross-library words and vendor names: `Trainium`,
`Backblaze`, `Filestore`, `preemption(s)`, `bottleneck(ed|ing)`,
`iterable(s)`, `serializable`, and `colocated`.
- Casing-only fixes such as `Jax` and `Tensorboard` come from the accept
list driving `Vale.Terms` rather than from a swap, so no token alerts
twice.
- **RLlib accept list fix:** `[Pp]y[Tt]orch` and `[Tt]ensor[Ff]low`
become `PyTorch` and `TensorFlow`. Vocabularies register globally, so
those bracket classes accepted `Pytorch` and `Tensorflow` in every
library and silently overrode the Train vocabulary's casing. The change
adds no alerts under `doc/source/rllib`. It surfaces 15 miscased brand
names in prose elsewhere, across Serve, Tune, KubeRay, cluster,
getting-started, and Train pages. It also flags the "Not" column of the
new guide table, as intended, and one `:link:` false positive, described
under Testing.
- **`Ray/Brands.yml`:** adds `WandB` → `W&B`. It's case-sensitive, so
the lowercase package name `wandb` doesn't match.
- **`.vale.ini`:** a `[doc/source/train/**/*.{md,rst}]` section with
`Vale, Google, Ray, Train`, which mirrors the Core block.
- **`writing-style.md`:** a "Writing Ray Train docs" section with a
terms table. Both Train rules link to it through the
`ray-train-docs-style` label. The section also places a Train worker
relative to a Ray Core worker process.

No prose under `doc/source/train/` changes here. The style pass that
fixes the alerts follows in separate PRs stacked on this one.

## Duplicate check

No open PR adds Ray Train Vale rules. I searched open `ray-project/ray`
PRs for `vale train` and for `writing-style.md`. The only hits are
#66809, my own CI change with no Vale or style-guide edits, and #65707,
a KubeRay docs change.

## Testing

Commands, run from the repo root:

```bash
vale --output=JSON doc/source/train/
vale --output=line doc/source/   # before and after, diffed
pre-commit run --files <changed files>
```

Results with Vale 3.12.0:

- **`doc/source/train/`:** total alerts go from 839 to 802.
`Train.Terms` raises 5 alerts, all true positives.
`Train.Capitalization` raises 29: `Trainer` concept uses, title-cased
`Fault Tolerance` and `Local Mode`, and the Lightning and Transformers
`Trainer` mentions that the style pass should put in code style.
`Vale.Spelling` drops from 77 to 43. The rest is mostly unbackticked
code and identifiers for the prose pass. No position alerts twice across
`Vale.Terms`, `Vale.Spelling`, `Train.*`, `Ray.Terms`, and `Ray.Brands`.
- **Rule check against the new guide table:** linting the table rows
under the Train scope fires on every "Not" form except a bare `Trainer`,
which the rule deliberately doesn't match.
- **Other scopes:** compared alert by alert over `doc/source/rllib`,
`doc/source/core`, and `doc/source/kuberay`, the accept-list entries
remove 4 false positives (`serializable`, `colocated`, `JAX`, and one
`Google.Parens`). The only new alerts are 5 true-positive `WandB` hits
in RLlib, from the shared `Ray/Brands.yml`. Across all of `doc/source`,
the RLlib accept-list fix is the only other source of new alerts.
- **Known false positive:** Vale reads a sphinx-design `:link:` option
as prose. `train/more-frameworks.md:43` (`:link:
distributed-tensorflow-keras`) alerted on `keras` before this PR and now
also alerts on `tensorflow`. A section-scoped `TokenIgnores = (:link:
\S+)` didn't suppress it, so it's left as a follow-up. Five `:link:`
lines exist across `doc/source`.
- **pre-commit:** passed on the changed files.
- **Not run locally:** the Sphinx build. The only `doc/source` change is
one new section and label in `writing-style.md`. The RtD preview covers
it.

Prepared with AI assistance (Claude Code). Draft until the submitter has
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]>
dstrodtman added a commit that referenced this pull request Oct 23, 2026
…enforced) (#67017)

## Why are these changes needed?

This PR adds Vale terminology rules for Ray Tune docs ahead of a style
pass over those pages. It follows the pattern from #65239 (KubeRay),
#66236 (RLlib), #66640 (Ray Core), and #66885 (Ray Train). Every rule is
warn-level and **doesn't run in CI yet**. Registering the config lets
contributors run `vale doc/source/tune/` by hand during the style pass.

Builds on #67015 (merged), which renamed the Tune tutorials landing and
hyphenated page slugs. The style pass PRs stacked on this one edit pages
under those final names.

## What's here

- **`.vale/styles/Tune/Terms.yml`:** case-sensitive `substitution` swaps
at `level: warning`, each safe to apply without judgment, so the file
sets `action: replace`. It spells out abbreviations in prose: `search
alg`, `config dict`, `trial dir`, and `experiment dir`. The arguments
and attributes keep code style.
- **`.vale/styles/Tune/Capitalization.yml`:** title-cased generic nouns,
such as `Search Algorithm`, `Trial Scheduler`, `Function API`, and
`Bayesian Optimization`, plus `Trainable` written as the concept.
Applying any of these takes judgment, so this rule has no replace
action:
- Lowercasing would also drop the capital at the start of a heading or
sentence, which has to stay.
- A bare "Trainable" in prose is often the class, which needs code style
rather than lowercase. The rule's keys carry a preceding word, such as
`the Trainable` and `your Trainable`, and leave the decision to a
person.
- "Bayesian Optimization" sometimes names the `bayesian-optimization`
package rather than the technique.
- **"Scheduler" is deliberately not a rule.** Ray Core and Kubernetes
both have schedulers. The guide asks for "trial scheduler" where a page
discusses more than one kind, and the rule flags only the title-cased
`Trial Scheduler`.
- **Accept lists:**
- New `Tune` vocabulary: `trainable(s)`, `syncer(s)`, the search
libraries `Hyperopt`, `Optuna`, `Nevergrad`, `BayesOpt`, `ZOOpt`,
`HEBO`, and `Ax`, and the algorithm names `Hyperband`, `ASHA`, `BOHB`,
`PBT`, `PB2`, and `TPE`.
- `General` gains cross-library words: `docstring(s)`, `traceback(s)`,
`runtimes`, `errored`, and `underperforming`.
- Casing-only fixes such as `HyperOpt` and `HyperBand` come from the
accept list driving `Vale.Terms` rather than from a swap, so no token
alerts twice.
- **`.vale.ini`:** registers `Tune` on the `Vocab` line and adds a
`[doc/source/tune/**/*.{md,rst}]` section with `Vale, Google, Ray,
Tune`, which mirrors the Train block.
- **`writing-style.md`:** a "Writing Ray Tune docs" section with a terms
table. Both Tune rules link to it through the `ray-tune-docs-style`
label. The section also separates "trial" from "experiment," which the
current prose uses loosely. An experiment is one `Tuner.fit()` call, and
a trial is one run of the trainable with one hyperparameter
configuration.

No prose under `doc/source/tune/` changes here. The style pass that
fixes the alerts follows in separate PRs stacked on this one.

## Duplicate check

No open PR adds Ray Tune Vale rules. I searched open `ray-project/ray`
PRs for `vale tune`, `writing-style.md`, and Tune docs titles. The hits
are #66809, my own CI change with no Vale or style-guide edits, #65707,
a KubeRay docs change, #64137, a Ray Core NIXL guide, and #67015, the
rename this work builds on (now merged).

## Testing

Commands, run from the repo root:

```bash
vale --output=JSON doc/source/tune/
vale --output=line doc/source/   # on the base branch and on this branch, diffed
pre-commit run --files <changed files>
```

Results with Vale 3.12.0:

- **`doc/source/tune/`:** total alerts go from 1,239 to 1,437. Most of
the increase is the shared `Ray` style now applying to Tune.
`Tune.Capitalization` raises 118 alerts and `Tune.Terms` raises 1, all
in title-cased concept nouns or spelled-out abbreviations.
`Vale.Spelling` drops from 88 to 50. No position alerts twice across
`Vale.Terms`, `Vale.Spelling`, and `Tune.*`.
- **Two alert sources the style pass should handle rather than
suppress:**
- Library names in `api/suggestion.rst` headings, such as `Optuna
(tune.search.optuna.OptunaSearch)`, now alert under `Vale.Terms` on the
lowercase module segment. The module path belongs in code style.
- `tutorials/tune-lifecycle.md` alerts on `ERRORED`, which it lists as a
trial status. The source defines the status as `ERROR` (`Trial.ERROR` in
`python/ray/tune/experiment/trial.py`), so that's a doc correction.
- **Rule check against the new guide table:** linting the table rows
fires `Vale.Terms` on `HyperBand`, `HyperOpt`, `hyperopt`, and `AX` in
the "Not" column, as intended, the same as the Train table.
- **Other scopes:** compared alert by alert across all of `doc/source`
outside `tune/`, the only change is 17 removed alerts. They're false
positives on `runtimes`, `errored`, `docstring`, `traceback`, and
`Hyperopt` in Core, KubeRay, Serve, Train, observability, and
contributor pages, plus one `Google.Parens` alert in
`kuberay/user-guides/configuring-ippr.md:281` that the accept list now
shadows. No new alerts.
- **pre-commit:** passed on the changed files.
- **Not run locally:** the Sphinx build. The only `doc/source` change is
one new section and label in `writing-style.md`. The RtD preview covers
it.

Prepared with AI assistance (Claude Code). Draft until the submitter has
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]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants