Skip to content

feat(runtimes): make MPI launcher depend on worker readiness#3685

Open
Amir380-A wants to merge 12 commits into
kubeflow:masterfrom
Amir380-A:feat/mpi-launcher-dependson
Open

feat(runtimes): make MPI launcher depend on worker readiness#3685
Amir380-A wants to merge 12 commits into
kubeflow:masterfrom
Amir380-A:feat/mpi-launcher-dependson

Conversation

@Amir380-A

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This PR updates the MPI-based ClusterTrainingRuntimes (DeepSpeed and MLX) to ensure the launcher replicated job is created only after the node replicated job becomes Ready by using JobSet's dependsOn API.

Which issue(s) this PR fixes
Fixes #2751

Copilot AI review requested due to automatic review settings July 3, 2026 06:40
@google-oss-prow google-oss-prow Bot requested a review from akshaychitneni July 3, 2026 06:40
@google-oss-prow

Copy link
Copy Markdown

[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 electronic-waste 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

@google-oss-prow google-oss-prow Bot requested a review from jinchihe July 3, 2026 06:40
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🎉 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! 🙏

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.

Pull request overview

This PR updates the MPI-based ClusterTrainingRuntime definitions for DeepSpeed and MLX so the launcher replicated job is only created after the worker (“node”) replicated job reaches Ready, using JobSet’s dependsOn API. This directly addresses issue #2751 by preventing the launcher from starting (and failing) before MPI workers are ready to accept connections.

Changes:

  • Reordered replicatedJobs so node comes before launcher (required because the first replicated job cannot use dependsOn).
  • Added dependsOn: [{ name: node, status: Ready }] to the launcher replicated job for both DeepSpeed and MLX.
  • Updated Helm unittest assertions to reflect the new replicated job ordering and dependency.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
manifests/base/runtimes/mlx_distributed.yaml Makes MLX launcher creation depend on node readiness via dependsOn.
manifests/base/runtimes/deepspeed_distributed.yaml Makes DeepSpeed launcher creation depend on node readiness via dependsOn.
charts/kubeflow-trainer/templates/runtimes/mlx-distributed.yaml Helm template update to emit the dependsOn relationship and new ordering.
charts/kubeflow-trainer/templates/runtimes/deepspeed-distributed.yaml Helm template update to emit the dependsOn relationship and new ordering.
charts/kubeflow-trainer/tests/runtimes/mlx_distributed_test.yaml Updates Helm unittest expectations for replicated job order and dependsOn.
charts/kubeflow-trainer/tests/runtimes/deepspeed_distributed_test.yaml Updates Helm unittest expectations for replicated job order and dependsOn.

@Amir380-A

Copy link
Copy Markdown
Contributor Author

/ok-to-test

@google-oss-prow

Copy link
Copy Markdown

@Amir380-A: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@andreyvelich andreyvelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/ok-to-test
/retest

@andreyvelich andreyvelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this @Amir380-A!
Please can you also update the Integration Test:
https://github.com/Amir380-A/trainer/blob/411c212a8a95c566678bda243a7c1927742f3b22/test/integration/controller/trainjob_controller_test.go#L1040
To ensure we have similar DependsOn configuration there.

/ok-to-test
/retest

@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from 402c2f9 to 6897f95 Compare July 5, 2026 17:13
@andreyvelich

Copy link
Copy Markdown
Member

@Amir380-A Could you check why E2Es are failing please?

@andreyvelich

Copy link
Copy Markdown
Member

/milestone v2.3

@google-oss-prow google-oss-prow Bot added this to the v2.3 milestone Jul 8, 2026
@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from 831e4ee to 92dc620 Compare July 8, 2026 20:49
@Amir380-A

Copy link
Copy Markdown
Contributor Author

/retest

@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch 2 times, most recently from 8458216 to d7eb6cb Compare July 9, 2026 04:12
@google-oss-prow google-oss-prow Bot added size/XL and removed size/L labels Jul 9, 2026
@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from 09a48c1 to 92dc620 Compare July 9, 2026 10:28
@google-oss-prow google-oss-prow Bot added size/L and removed size/XL labels Jul 9, 2026
Comment on lines +47 to +48
securityContext:
fsGroup: 1000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do you require to introduce Security Context as part of this PR?
I was able to run DeepSpeed runtime without it and with DependsOn on my local Kind cluster.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I couldn't run DeepSpeed locally because of the massive size of the images required.
In GitHub Actions however, the DeepSpeed E2E was consistently failing with:

Unable to load host key: /home/mpiuser/.ssh/id_rsa
sshd: no hostkeys available -- exiting.

After adding the pod securityContext with fsGroup, the SSH key became readable by the container, sshd started successfully and the Helm E2E passed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think, runAsGroup: 1000 might fail the E2Es.
Can you try to remove that alongside the securityContext? It should be working fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from fdb70e4 to 7cb1e7c Compare July 9, 2026 17:41
@Amir380-A

Amir380-A commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

/test E2E Tests / GPU E2E Test (1.33.1) (pull_request)

@google-oss-prow

Copy link
Copy Markdown

@Amir380-A: No presubmit jobs available for kubeflow/trainer@master

Details

In response to this:

/test E2E Tests / GPU E2E Test (1.33.1) (pull_request)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@google-oss-prow

Copy link
Copy Markdown

@Amir380-A: No presubmit jobs available for kubeflow/trainer@master

Details

In response to this:

/test E2E Tests / GPU E2E Test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from 7cb1e7c to 5708d84 Compare July 10, 2026 12:04
@google-oss-prow google-oss-prow Bot added size/XS and removed size/L labels Jul 10, 2026
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
@Amir380-A Amir380-A force-pushed the feat/mpi-launcher-dependson branch from 5708d84 to 8f57043 Compare July 10, 2026 12:34
@google-oss-prow google-oss-prow Bot added size/L and removed size/XS labels Jul 10, 2026
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
@google-oss-prow google-oss-prow Bot added size/M and removed size/L labels Jul 10, 2026
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Jul 10, 2026
Signed-off-by: Amir380-A <62997533+Amir380-A@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhanced MPI Support in TrainJob

3 participants