Skip to content

Commit

Permalink
Add scaffold for Yunikorn batch scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsalway committed Jul 25, 2024
1 parent b8c9013 commit 78f6ae2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/batchscheduler/scheduler_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ import (

"github.com/kubeflow/spark-operator/pkg/batchscheduler/interface"
"github.com/kubeflow/spark-operator/pkg/batchscheduler/volcano"
"github.com/kubeflow/spark-operator/pkg/batchscheduler/yunikorn"
)

type schedulerInitializeFunc func(config *rest.Config) (schedulerinterface.BatchScheduler, error)

var schedulerContainers = map[string]schedulerInitializeFunc{
volcano.GetPluginName(): volcano.New,
volcano.GetPluginName(): volcano.New,
yunikorn.GetPluginName(): yunikorn.New,
}

func GetRegisteredNames() []string {
Expand Down
37 changes: 37 additions & 0 deletions pkg/batchscheduler/yunikorn/yunikorn_scheduler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package yunikorn

import (
"k8s.io/client-go/rest"

"github.com/kubeflow/spark-operator/pkg/apis/sparkoperator.k8s.io/v1beta2"
schedulerinterface "github.com/kubeflow/spark-operator/pkg/batchscheduler/interface"
)

type YunikornBatchScheduler struct{}

func GetPluginName() string {
return "yunikorn"
}

func (y *YunikornBatchScheduler) Name() string {
return GetPluginName()
}

func New(config *rest.Config) (schedulerinterface.BatchScheduler, error) {
return &YunikornBatchScheduler{}, nil
}

func (y *YunikornBatchScheduler) ShouldSchedule(app *v1beta2.SparkApplication) bool {
// Yunikorn doesn't require any additional resources to be created before scheduling
// since it gets all the information it needs from pod annotations
return true
}

func (y *YunikornBatchScheduler) CleanupOnCompletion(app *v1beta2.SparkApplication) error {
// No additional resources are created so nothing to clean up
return nil
}

func (y *YunikornBatchScheduler) DoBatchSchedulingOnSubmission(app *v1beta2.SparkApplication) error {
return nil
}

0 comments on commit 78f6ae2

Please sign in to comment.