-
Notifications
You must be signed in to change notification settings - Fork 671
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
Updating annotations of pods belonging Ray cluster in order to adopting Yunikorn Gang scheduling #5594
base: master
Are you sure you want to change the base?
Conversation
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5594 +/- ##
==========================================
- Coverage 36.17% 34.44% -1.73%
==========================================
Files 1302 1143 -159
Lines 109492 102898 -6594
==========================================
- Hits 39606 35446 -4160
+ Misses 65748 63776 -1972
+ Partials 4138 3676 -462
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
flyteplugins/go/tasks/plugins/k8s/ray/batchscheduler/config/config.go
Outdated
Show resolved
Hide resolved
flyteplugins/go/tasks/plugins/k8s/ray/batchscheduler/config/config_test.go
Outdated
Show resolved
Hide resolved
flyteplugins/go/tasks/plugins/k8s/ray/batchscheduler/scheduler/yunikorn/yunikorn.go
Outdated
Show resolved
Hide resolved
flyteplugins/go/tasks/plugins/k8s/ray/batchscheduler/plugins.go
Outdated
Show resolved
Hide resolved
flyteplugins/go/tasks/plugins/k8s/ray/batchscheduler/plugins.go
Outdated
Show resolved
Hide resolved
Hi @pingsutw, thanks for review. |
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
1bbd46b
to
43b88b7
Compare
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
@0yukali0 thank you, this is great. Let us know if you need help taking this to the finish line. This is important for several Flyte users |
Thanks @davidmirror-ops , i will. |
Signed-off-by: yuteng <[email protected]>
Signed-off-by: yuteng <[email protected]>
flyteplugins/go/tasks/plugins/k8s/batchscheduler/scheduler/kubernetes/default.go
Outdated
Show resolved
Hide resolved
flyteplugins/go/tasks/plugins/k8s/batchscheduler/scheduler/kubernetes/default.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: yuteng <[email protected]>
"k8s.io/apimachinery/pkg/api/resource" | ||
) | ||
|
||
func MutateRayJob(parameters string, app *rayv1.RayJob) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add some comments explaining what this does?
@@ -0,0 +1,16 @@ | |||
package scheduler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add some module level comments that will help in generated docs
) | ||
|
||
type SchedulerManager interface { | ||
// Mutate is responsible for mutating the object to be scheduled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets explain that the Mutate method will mutate the object in place.
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type SchedulerManager interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about docs that say,something to this effect)
type SchedulerManager interface { | |
// SchedulerManager is an interface that allows plugging in custom schedulers | |
// such as Yunikorn, Kueue, or any other scheduler that manages pod scheduling | |
// with advanced features like gang scheduling, preemption, and priority. | |
type SchedulerManager interface { |
@@ -0,0 +1,23 @@ | |||
package batchscheduler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package batchscheduler | |
// Flyte often deals with complex, distributed workloads that may require advanced scheduling features. Native Kubernetes scheduling may not suffice for scenarios that involve job-level scheduling policies like gang scheduling or job preemption. The SchedulerManager interface provides a flexible mechanism for integrating such schedulers into Flyte’s plugin system by allowing mutation of the scheduling-related properties of Kubernetes objects. | |
package batchscheduler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also how about we call this scheduler?
type SchedulerManager interface { | ||
// Mutate is responsible for mutating the object to be scheduled. | ||
// It will add the necessary annotations, labels, etc. to the object. | ||
Mutate(ctx context.Context, object client.Object) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mutate(ctx context.Context, object client.Object) error | |
// Mutate allows the custom scheduler to modify the given Kubernetes object (e.g., a Pod or | |
// a custom resource representing a job) before it is submitted to the Kubernetes API. | |
// This may include adding annotations, labels, or modifying fields related to scheduling. | |
// The object is typically a Kubernetes Pod or a custom resource. | |
// It returns an error if the mutation fails. | |
Mutate(ctx context.Context, object client.Object) error |
|
||
func (y *YunikornSchedulerManager) Mutate(ctx context.Context, object client.Object) error { | ||
switch object.(type) { | ||
case *rayv1.RayJob: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird isnt it?
WE have a common interface, but have a switch for each?
In this case, we should allow this overriding to exist next to ray job plugin and not with yunikorn. this will break when things update pretty quickly.
Why have a common interface?
@@ -203,6 +205,12 @@ func (e *PluginManager) launchResource(ctx context.Context, tCtx pluginsCore.Tas | |||
|
|||
key := backoff.ComposeResourceKey(o) | |||
|
|||
err = e.schedulerMgr.Mutate(ctx, o) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is why... So here is my suggestion, how about we handle the scheduler related changes directly to the plugin itself.
For example
MutateForGangScheduling
Also how about preemption etc if we add that in the future?
I love this PR, @0yukali0 but there is probably a better way to introduce this interface. I do not love the idea of adding cases in a separate place from the actual ray job plugin. My preference is to keep all that code under one module, also avoids imports Also can you share an example of how preemption and priority works with yunikorn? |
Adding support for a gang scheduler is a great effort, thank you 🙏 I personally am not a huge fan of the folder/module structure proposed in this PR because for each k8s plugin, we'd need to create another module under Is my understanding correct that we "only" have to add yunikorn annotations to the respective pod template specs? If yes, would it be possible to have one central helper function defined that can be imported in the plugins and, if configured in the respective plugin's config, is called in the |
Signed-off-by: yuteng <[email protected]>
Tracking issue
Related to #5575
Why are the changes needed?
Ability to classify pods to different gang scheduling group based on their role and worker group number.
Currently, Pods under ray cluster share same gang scheduling task group via podTemplate.
With same pod spec, pods share same gang scheduling group name when adopting yunikorn.
What changes were proposed in this pull request?
For enable gang scheduling with yunikorn, updating annotations pods belonging to ray cluster based on role and number of worker group.
How was this patch tested?
run make test_unit and make lint in flyteplugins.
Setup process
helm install yunikorn yunikorn/yunikorn -f values.yaml -n yunikorn --create-namespace
4. Set flyte plugin ray
5.Submit ray example
Screenshots
chments/assets/d3d7d765-598f-4fcc-ae40-86bb8d684681)
Check all the applicable boxes
Related PRs
Docs link
Yunikorn gang scheduling doc