Skip to content

fix(framework): stop Flux appending the Runtime args to the training command - #4003

Open
rjgoyln wants to merge 1 commit into
kubeflow:masterfrom
rjgoyln:fix/flux-trainer-args
Open

fix(framework): stop Flux appending the Runtime args to the training command#4003
rjgoyln wants to merge 1 commit into
kubeflow:masterfrom
rjgoyln:fix/flux-trainer-args

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The Flux plugin wraps the training command in its entrypoint so that only the entrypoint controls execution, and clears .spec.trainer.args to say so. That only stops the JobSet builder from re-applying the TrainJob's args — the ones the Runtime declares stay on the container, and entrypoint.sh collapses every argument it receives onto the command it wraps. A TrainJob asking for --epochs 3 against a Runtime declaring --epochs 10 runs with both, the Runtime's value last; no runtime under examples/flux/ declares args, which is why the path has gone unnoticed.

The same asymmetry drops those args in the other direction: the wrapped command falls back to the Runtime-declared command when the TrainJob overrides nothing, but args were only ever read from the TrainJob.

Change

Both halves come down to the field-by-field != nil override the builder already applies for every other runtime. Clearing now means an empty rather than nil .spec.trainer.args, so the builder replaces the Runtime's args instead of skipping them — the mirror of #3904, which allocates a Trainer so that same rule can carry the entrypoint command. Wrapping takes the Runtime's args as its base, so a TrainJob overriding only command keeps them.

Reading them needs Args on the PodSet Container, continuing #3674, which exposed Image and Command for the same reason. It is inbound only: syncing it back out is #3967's to make, and resolving args into the template there needs the empty value this PR introduces.

slices.Concat replaces append, which could otherwise write into the PodSet container's own backing array now that command and args both come from there.

Checklist:

  • Docs included if any changes are user facing

@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 terrytangyuan 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

@github-actions

Copy link
Copy Markdown
Contributor

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.
  • Our team will review your PR soon! cc @kubeflow/kubeflow-trainer-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

…command

The Flux entrypoint wraps the training command so that only it controls
execution, and the plugin clears `.spec.trainer.args` to say so. Clearing the
TrainJob field only stops the JobSet builder from re-applying it, though: the
args the Runtime itself declares stay on the container, and the entrypoint
collapses every positional argument it receives onto the command it wraps. A
TrainJob asking for `--epochs 3` against a Runtime declaring `--epochs 10` runs
the training command with both, the Runtime's value last.

The same asymmetry loses those args from the wrapped command. It falls back to
the Runtime-declared command when the TrainJob overrides nothing, but the args
were only ever read from the TrainJob, so a Runtime that declares args and a
TrainJob that does not produced a command missing them.

Signed-off-by: rjgoyln <pt40419@gmail.com>
@rjgoyln
rjgoyln force-pushed the fix/flux-trainer-args branch from 92c16d7 to e0ff255 Compare August 28, 2026 16:14
@rjgoyln
rjgoyln marked this pull request as ready for review August 28, 2026 16:53
Copilot AI balanced review requested due to automatic review settings August 28, 2026 16:53
@google-oss-prow
google-oss-prow Bot requested a review from jinchihe August 28, 2026 16:53

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants