-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: yuteng <[email protected]>
- Loading branch information
Showing
20 changed files
with
228 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 13 additions & 11 deletions
24
flyteplugins/go/tasks/plugins/k8s/batchscheduler/config.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
package batchscheduler | ||
|
||
type Config struct { | ||
Scheduler string `json:"scheduler,omitempty" pflag:", Specify batch scheduler to"` | ||
Parameters string `json:"parameters,omitempty" pflag:", Specify static parameters"` | ||
Scheduler string `json:"scheduler,omitempty" pflag:", Specify batch scheduler to"` | ||
Default SchedulingConfig `json:"default,omitempty" pflag:", Specify default scheduling config which batch scheduler adopts"` | ||
NameSpace map[string]SchedulingConfig `json:"Namespace,omitempty" pflag:"-, Specify namespace scheduling config"` | ||
Domain map[string]SchedulingConfig `json:"Domain,omitempty" pflag:"-, Specify domain scheduling config"` | ||
} | ||
|
||
func NewConfig() Config { | ||
return Config{ | ||
Scheduler: "", | ||
Parameters: "", | ||
} | ||
type SchedulingConfig struct { | ||
KueueConfig `json:"Kueue,omitempty" pflag:", Specify Kueue scheduling scheduling config"` | ||
YunikornConfig `json:"Yunikorn,omitempty" pflag:", Yunikorn scheduling config"` | ||
} | ||
|
||
func (b *Config) GetScheduler() string { | ||
return b.Scheduler | ||
type KueueConfig struct { | ||
PriorityClassName string `json:"Priority,omitempty" pflag:", Kueue Prioty class"` | ||
Queue string `json:"Queue,omitempty" pflag:", Specify batch scheduler to"` | ||
} | ||
|
||
func (b *Config) GetParameters() string { | ||
return b.Parameters | ||
type YunikornConfig struct { | ||
Parameters string `json:"parameters,omitempty" pflag:", Specify gangscheduling policy"` | ||
Queue string `json:"queue,omitempty" pflag:", Specify leaf queue to submit to"` | ||
} |
15 changes: 0 additions & 15 deletions
15
flyteplugins/go/tasks/plugins/k8s/batchscheduler/config_test.go
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
flyteplugins/go/tasks/plugins/k8s/batchscheduler/kueue/helper.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kueue | ||
|
||
import ( | ||
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" | ||
|
||
"github.com/flyteorg/flyte/flyteplugins/go/tasks/plugins/k8s/batchscheduler/utils" | ||
) | ||
|
||
const ( | ||
QueueName = "kueue.x-k8s.io/queue-name" | ||
PriorityClassName = "kueue.x-k8s.io/priority-class" | ||
) | ||
|
||
func UpdateKueueLabels(labels map[string]string, app *rayv1.RayJob) { | ||
utils.UpdateLabels(labels, &app.ObjectMeta) | ||
} |
23 changes: 0 additions & 23 deletions
23
flyteplugins/go/tasks/plugins/k8s/batchscheduler/plugins.go
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
flyteplugins/go/tasks/plugins/k8s/batchscheduler/scheduler/noop_scheduler.go
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
flyteplugins/go/tasks/plugins/k8s/batchscheduler/scheduler/yunikorn/yunikorn.go
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
flyteplugins/go/tasks/plugins/k8s/batchscheduler/scheduler/yunikorn/yunikorn_test.go
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
flyteplugins/go/tasks/plugins/k8s/batchscheduler/utils/helper.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package utils | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func UpdateLabels(wanted map[string]string, objectMeta *metav1.ObjectMeta) { | ||
for key, value := range wanted { | ||
if _, exist := objectMeta.Labels[key]; !exist { | ||
objectMeta.Labels[key] = value | ||
} | ||
} | ||
} | ||
|
||
func UpdateAnnotations(wanted map[string]string, objectMeta *metav1.ObjectMeta) { | ||
for key, value := range wanted { | ||
if _, exist := objectMeta.Annotations[key]; !exist { | ||
objectMeta.Annotations[key] = value | ||
} | ||
} | ||
} | ||
|
||
func UpdatePodTemplateAnnotatations(wanted map[string]string, pod *v1.PodTemplateSpec) { | ||
UpdateAnnotations(wanted, &pod.ObjectMeta) | ||
} | ||
|
||
func UpdatePodTemplateLabels(wanted map[string]string, pod *v1.PodTemplateSpec) { | ||
UpdateLabels(wanted, &pod.ObjectMeta) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.