Skip to content

Commit

Permalink
Merge branch 'master' into dev-pdb-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-mask authored Sep 12, 2023
2 parents c69e47f + 8311953 commit bf43d65
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/scheduler/api/job_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
batch "volcano.sh/apis/pkg/apis/batch/v1alpha1"
"volcano.sh/apis/pkg/apis/scheduling"
"volcano.sh/apis/pkg/apis/scheduling/v1beta1"

volumescheduling "volcano.sh/volcano/pkg/scheduler/capabilities/volumebinding"
)

Expand Down Expand Up @@ -130,6 +131,11 @@ type TaskInfo struct {
NumaInfo *TopologyInfo
PodVolumes *volumescheduling.PodVolumes
Pod *v1.Pod

// CustomBindErrHandler is a custom callback func called when task bind err.
CustomBindErrHandler func() error
// CustomBindErrHandlerSucceeded indicates whether CustomBindErrHandler is executed successfully.
CustomBindErrHandlerSucceeded bool
}

func getJobID(pod *v1.Pod) JobID {
Expand Down
15 changes: 15 additions & 0 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,24 @@ func (sc *SchedulerCache) processResyncTask() {
return
}

reSynced := false
if err := sc.syncTask(task); err != nil {
klog.Errorf("Failed to sync pod <%v/%v>, retry it.", task.Namespace, task.Name)
sc.resyncTask(task)
reSynced = true
}

// execute custom bind err handler call back func if exists.
if task.CustomBindErrHandler != nil && !task.CustomBindErrHandlerSucceeded {
err := task.CustomBindErrHandler()
if err != nil {
klog.ErrorS(err, "Failed to execute custom bind err handler, retry it.")
} else {
task.CustomBindErrHandlerSucceeded = true
}
if !task.CustomBindErrHandlerSucceeded && !reSynced {
sc.resyncTask(task)
}
}
}

Expand Down

0 comments on commit bf43d65

Please sign in to comment.