Skip to content

Commit

Permalink
fix scheduler panic issue (volcano-sh#39)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhe Jin <jinzhe.hit@gmail.com>

Signed-off-by: Zhe Jin <jinzhe.hit@gmail.com>
Co-authored-by: Zhe Jin <jinzhe.hit@gmail.com>
  • Loading branch information
yolgun and jinzhejz authored Sep 20, 2022
1 parent 66f7dbc commit 176de8f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,22 +825,26 @@ func (sc *SchedulerCache) processBindTask() {

func (sc *SchedulerCache) BindTask() {
klog.V(5).Infof("batch bind task count %d", len(sc.bindCache))
successfulTasks := make([]*schedulingapi.TaskInfo, 0)
for _, task := range sc.bindCache {
if err := sc.VolumeBinder.BindVolumes(task, task.PodVolumes); err != nil {
klog.Errorf("task %s/%s bind Volumes failed: %#v", task.Namespace, task.Name, err)
sc.VolumeBinder.RevertVolumes(task, task.PodVolumes)
sc.resyncTask(task)
return
} else {
successfulTasks = append(successfulTasks, task)
klog.V(5).Infof("task %s/%s bind Volumes done", task.Namespace, task.Name)
}
}

bindTasks := make([]*schedulingapi.TaskInfo, len(sc.bindCache))
copy(bindTasks, sc.bindCache)
bindTasks := make([]*schedulingapi.TaskInfo, len(successfulTasks))
copy(bindTasks, successfulTasks)
if err := sc.Bind(bindTasks); err != nil {
klog.Errorf("failed to bind task count %d: %#v", len(bindTasks), err)
return
}

for _, task := range sc.bindCache {
for _, task := range successfulTasks {
metrics.UpdateTaskScheduleDuration(metrics.Duration(task.Pod.CreationTimestamp.Time))
}

Expand Down

0 comments on commit 176de8f

Please sign in to comment.