Skip to content

Commit

Permalink
Apply total resource when BatchSchedulerOption is not nil (kubeflow#1072
Browse files Browse the repository at this point in the history
)

* Apply total resource when BatchSchedulerOption is not nil

* Reduce unnecessary if statement in volcano_scheduler
  • Loading branch information
nicholas-fwang authored Nov 19, 2020
1 parent 7c92491 commit 480d348
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/batchscheduler/volcano/volcano_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ func (v *VolcanoBatchScheduler) DoBatchSchedulingOnSubmission(app *v1beta2.Spark
func (v *VolcanoBatchScheduler) syncPodGroupInClientMode(app *v1beta2.SparkApplication) error {
// We only care about the executor pods in client mode
if _, ok := app.Spec.Executor.Annotations[v1beta1.KubeGroupNameAnnotationKey]; !ok {
var totalResource corev1.ResourceList
requestResources := app.Spec.BatchSchedulerOptions.Resources
if len(requestResources) > 0 {
totalResource = requestResources
} else {
totalResource = getExecutorRequestResource(app)
totalResource := getExecutorRequestResource(app)

if app.Spec.BatchSchedulerOptions != nil && len(app.Spec.BatchSchedulerOptions.Resources) > 0 {
totalResource = app.Spec.BatchSchedulerOptions.Resources
}
if err := v.syncPodGroup(app, 1, totalResource); err == nil {
app.Spec.Executor.Annotations[v1beta1.KubeGroupNameAnnotationKey] = v.getAppPodGroupName(app)
Expand All @@ -97,9 +95,9 @@ func (v *VolcanoBatchScheduler) syncPodGroupInClusterMode(app *v1beta2.SparkAppl
if _, ok := app.Spec.Driver.Annotations[v1beta1.KubeGroupNameAnnotationKey]; !ok {
//Both driver and executor resource will be considered.
totalResource := sumResourceList([]corev1.ResourceList{getExecutorRequestResource(app), getDriverRequestResource(app)})
requestResources := app.Spec.BatchSchedulerOptions.Resources
if len(requestResources) > 0 {
totalResource = requestResources

if app.Spec.BatchSchedulerOptions != nil && len(app.Spec.BatchSchedulerOptions.Resources) > 0 {
totalResource = app.Spec.BatchSchedulerOptions.Resources
}
if err := v.syncPodGroup(app, 1, totalResource); err == nil {
app.Spec.Executor.Annotations[v1beta1.KubeGroupNameAnnotationKey] = v.getAppPodGroupName(app)
Expand Down

0 comments on commit 480d348

Please sign in to comment.