Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEP-672: Serial Job Execution with DependsOn API #680

Merged
merged 25 commits into from
Dec 12, 2024

Conversation

andreyvelich
Copy link
Contributor

What type of PR is this?

Part of: #672.

/kind feature
/kind api-change

What this PR does / why we need it:

I created initial KEP for the ExecutionPolicy API.

A few points:

  1. I was thinking a bit more on the ExecutionPolicyOption and we might want to introduce the ExecutionPolicyRule API, since the ReplicatedJob status can be different in the Job sequence.
    For example, when MPIJob is created, the Initializer Job should be in Succeeded state, but the Launcher should be in the Ready state before running the mpirun command. WDYT about this API @tenzen-y @alculquicondor ?

  2. @vsoch Please can you help us with the HPC use-case when Job sequence can be useful ?

  3. Quota management via Kueue is still under discussion. What do you think we should add to this KEP ?

Special notes for your reviewer:

/assign @tenzen-y @johnugeorge @ahg-g @kannon92 @danielvegamyhre @googs1025 @akshaychitneni @shravan-achar

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Sep 26, 2024
@k8s-ci-robot k8s-ci-robot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Sep 26, 2024
@k8s-ci-robot
Copy link
Contributor

@andreyvelich: GitHub didn't allow me to assign the following users: shravan-achar, johnugeorge, akshaychitneni.

Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

What type of PR is this?

Part of: #672.

/kind feature
/kind api-change

What this PR does / why we need it:

I created initial KEP for the ExecutionPolicy API.

A few points:

  1. I was thinking a bit more on the ExecutionPolicyOption and we might want to introduce the ExecutionPolicyRule API, since the ReplicatedJob status can be different in the Job sequence.
    For example, when MPIJob is created, the Initializer Job should be in Succeeded state, but the Launcher should be in the Ready state before running the mpirun command. WDYT about this API @tenzen-y @alculquicondor ?

  2. @vsoch Please can you help us with the HPC use-case when Job sequence can be useful ?

  3. Quota management via Kueue is still under discussion. What do you think we should add to this KEP ?

Special notes for your reviewer:

/assign @tenzen-y @johnugeorge @ahg-g @kannon92 @danielvegamyhre @googs1025 @akshaychitneni @shravan-achar

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 26, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @andreyvelich!

It looks like this is your first PR to kubernetes-sigs/jobset 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/jobset has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 26, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @andreyvelich. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 26, 2024
Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for kubernetes-sigs-jobset ready!

Name Link
🔨 Latest commit ea622a6
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-jobset/deploys/67583dfad0cdc000083339bb
😎 Deploy Preview https://deploy-preview-680--kubernetes-sigs-jobset.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@alculquicondor
Copy link

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 26, 2024
- name: model-initializer
persistentVolumeClaim:
claimName: model-initializer
- name: Node
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "Node" name is a bit confusing to me since this is for a fine tuning replicatedJob, maybe rename to "finetuner" or something like that? Same for story 2.

Copy link
Contributor Author

@andreyvelich andreyvelich Sep 30, 2024

Choose a reason for hiding this comment

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

I think, we make the Node name here on purpose, since from the distributed training perspective this ReplicatedJob represents the single Training Node.
Here is the table which explains it: https://github.com/kubeflow/training-operator/tree/master/docs/proposals/2170-kubeflow-training-v2#worker-and-node-definition.

That allows users to easily understand that once this Job spawns multiple Pods each Pod is a separate distributed training Node.
cc @tenzen-y

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We discussed today with @tenzen-y that we probably name this Job template as TrainerNode to make it clearer for user.

// Names of the replicated Jobs that applied the status.
TargetReplicatedJobs []string `json:"targetReplicatedJobs"`

// Status in which the next replicated Jobs will be created.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Status in which the next replicated Jobs will be created.
// Status the target replicated jobs much reach before subsequent replicated jobs begin executing.


Open Questions:

1. How we should calculate quota for JobSet with execution policy ?
Copy link
Contributor

@danielvegamyhre danielvegamyhre Sep 26, 2024

Choose a reason for hiding this comment

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

Is quota here referring to Kueue? If so, can you elaborate on what makes quota calculation tricky here? Is it the serial execution potentially allowing for node re-use which complicates calculating the required quota?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is correct, the tricky part if we allow Kueue to admit JobSet if resources are available for the Initializer Job, but not available for the Trainer Job.
@tenzen-y How do you think we should implement the ExecutionPolicy initially in terms of Kueue integrations ?


#### Story 3

TODO: Add HPC use-case with Job sequence
Copy link
Contributor

Choose a reason for hiding this comment

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

The HPC use case could be similar to the already mentioned ML ones - e.g., "As an HPC user, I want to run a set of simulations with MPI that complete successfully (or some percentage) before using the data for a next step analysis. For the workload manager - "as a workload manager developer I want to ensure my lead broker is up and Ready before starting the workers to connect to it." Or a third case - "As an HPC user I want to scale up my simulation job only after a small set have completed successfully." And for that case, I could imagine essentially the same replicatedJob done twice, just with a larger size. If the outcome of the first isn't success you wouldn't launch the larger bulk of work.


// TODO: What statuses do we want to support in the first version ?
const (
ReadyStatus ReplicatedJobsStatusOption = "Ready"
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use an execution policy which specifies prior replicatedJobs must have a "Ready" status before subsequent ones can execute, isn't this effectively the same thing as using a StartupPolicy?

If so, perhaps we could eventually deprecate StartupPolicy in favor of this more flexible ExecutionPolicy over a couple releases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use an execution policy which specifies prior replicatedJobs must have a "Ready" status before subsequent ones can execute, isn't this effectively the same thing as using a StartupPolicy?

That is correct. Eventually, we just run the StartupPolicy functionality here.

If so, perhaps we could eventually deprecate StartupPolicy in favor of this more flexible ExecutionPolicy over a couple releases

I am fine with that, but want to hear @kannon92 @ahg-g @vsoch @tenzen-y opinion on that.

Copy link
Contributor

Choose a reason for hiding this comment

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

StartupPolicy seems more intuitive (from a user perspective) than an ExecutionPolicy -> Ready state, but I do think the latter is more flexible. I don't have a strong opinion either way, but if something is deprecated it should be well documented, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to phase out StartupPolicy over a few releases.

So I think this KEP should comment on compatibility between StartupPolicy and ExecutionPolicy.

If I specify StartupPolicy and execution Policy together, what would happen? Should we enforce validation so that these are "either or".

Copy link
Contributor

Choose a reason for hiding this comment

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

If I specify StartupPolicy and execution Policy together, what would happen? Should we enforce validation so that these are "either or".

Yes, I think we should enforce "either or" on the first release then deprecate startup policy over the next few releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, @kannon92 @danielvegamyhre do we need separate section to explain it ?
Currently, I explained it in the validation section:

StartupPolicy should be equal to AnyOrder when ExecutionPolicy is used.
The StartupPolicy API will be deprecated over the next few JobSet releases, since
ExecutionPolicy can be used with Ready status of ReplicatedJobs.

Copy link
Contributor

Choose a reason for hiding this comment

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

StartupPolicy should be equal to AnyOrder when ExecutionPolicy is used.
The StartupPolicy API will be deprecated over the next few JobSet releases, since
ExecutionPolicy can be used with Ready status of ReplicatedJobs.

This looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also extend the StartupPolicy API with the Succeeded semantics instead of creating a anew ExecutionPolicy field and deprecate the StartupPolicy one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kannon92
Copy link
Contributor

kannon92 commented Oct 3, 2024

/remove-kind api-change

@k8s-ci-robot k8s-ci-robot removed the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Oct 3, 2024

- ExecutionPolicy is immutable.
- ExecutionPolicyOrder of `AnyOrder` is default setting.
- StartupPolicy should be empty if ExecutionPolicy is set
Copy link
Contributor

Choose a reason for hiding this comment

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

I think StartupPolicy uses AnyOrder actually. So you would need to validate that StartupPolicy is not InOrder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

@andreyvelich andreyvelich changed the title [WIP] KEP-672: Add JobSet proposal for the ExecutionPolicy API KEP-672: Add JobSet proposal for the ExecutionPolicy API Oct 3, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 3, 2024

type ReplicatedJobsStatusOption string

// TODO: What statuses do we want to support in the first version ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Ready and Succeeded I think are the only ones we should support.

Copy link
Contributor

Choose a reason for hiding this comment

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

Though I would like to hear @ahg-g thoughts on ready..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with that. Support for Failed could be tricky given the failurePolicy API.

andreyvelich and others added 20 commits December 10, 2024 13:10
Co-authored-by: Michał Woźniak <mimowo@users.noreply.github.com>
Co-authored-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
Co-authored-by: Abdullah Gharaibeh <40361897+ahg-g@users.noreply.github.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>
Signed-off-by: Andrey Velichkevich <andrey.velichkevich@gmail.com>

User should configure JobSet as follows to use the existing functionality of StartupPolicy:

```yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

This was a bit confusing to me. For now, one could use startup policy or they can replicate it with the current API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, startupPolicy and dependsOn APIs are mutually exclusive, which means only one of them can be set.
I mentioned it in this section: https://github.com/kubernetes-sigs/jobset/pull/680/files/ea622a6d6ba8cfd876a7d662da2e141c977ecddc#diff-760e1d37e0293ac3b2c0170c72e6ac764d7abd930c1f746f1764db1abe6a12b7R403

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea I understand. Reading this text it was not clear to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it was pre coffee brain. Anyway I think this is fine.


- `controllers`: `01/19/2024` - `30.2%`

We will add this functionality to the startup_policy API for the functionality.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to deprecate startup policy I would probably put the execution policy elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by that ?
Similar to what @ahg-g proposed above, but with the executionPolicy field name: #680 (comment) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

We will add this functionality to the startup_policy API for the functionality.

You are going to put the code in startup_policy.go but we are going to deprecate startup_policy. That seems odd to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I think, we should put the code under depends_on.go or execution_policy.go file, but I am open to the various options.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea I think depends_on.go is fine but that is mostly an implementation detail.

Copy link
Contributor

@kannon92 kannon92 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your diligent follow through!

@ahg-g
Copy link
Contributor

ahg-g commented Dec 12, 2024

/lgtm
/approve

Thanks @andreyvelich

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 12, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, andreyvelich

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2024
@k8s-ci-robot k8s-ci-robot merged commit e794a5f into kubernetes-sigs:main Dec 12, 2024
12 checks passed
@andreyvelich andreyvelich deleted the kep-672 branch December 12, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.