Skip to content

fix(docs): fix two Trainer snippets that fail when copied - #941

Open
prabindersinghh wants to merge 1 commit into
kubeflow:mainfrom
prabindersinghh:docs/fix-broken-trainer-snippets
Open

prabindersinghh wants to merge 1 commit into
kubeflow:mainfrom
prabindersinghh:docs/fix-broken-trainer-snippets

Conversation

@prabindersinghh

@prabindersinghh prabindersinghh commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Two Trainer doc snippets raise as soon as they are run:

  • getting-started/quickstart.rst: the local backend example imports LocalProcessBackendConfig from kubeflow.trainer.backends.localprocess, which does not export it (ImportError). It now imports it from kubeflow.trainer.
  • train/runtimes.rst: the custom container example passes command= to CustomTrainerContainer, which has no such field (TypeError). It now sets the command with the TrainerCommand option, which is the supported way to override it.

Note on #876: it fixes the kubeflow.trainer.types import on the line just above the runtimes example. I changed that line to exactly what #876 uses, so whichever of the two merges second only needs a trivial rebase.

Validation:

  • both original snippets reproduced the errors on main
  • both updated snippets run against main, and TrainerCommand writes the command to .spec.trainer.command
  • pre-commit hooks: passed

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):

Fixes #939

Checklist:

  • Docs included if any changes are user facing

AI usage:

Claude was used to help find and fix the two snippets. I reviewed the changes and checked both snippets against main myself.

The local backend example in the quickstart imports LocalProcessBackendConfig
from kubeflow.trainer.backends.localprocess, which does not export it. Import it
from kubeflow.trainer instead.

The custom container example in runtimes passes command= to
CustomTrainerContainer, which has no such field and raises TypeError. Set the
command with the TrainerCommand option, which is the supported way to override
it.

Assisted-by: Claude

Signed-off-by: Prabinder Singh <prabindersinghh@gmail.com>
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andreyvelich for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Projects

Status: Ready to Merge

Development

Successfully merging this pull request may close these issues.

Docs: quickstart and runtimes Trainer snippets fail when copied

1 participant