Skip to content

Commit 176de8f

Browse files
yolgunjinzhejz
andauthored
fix scheduler panic issue (volcano-sh#39)
Signed-off-by: Zhe Jin <[email protected]> Signed-off-by: Zhe Jin <[email protected]> Co-authored-by: Zhe Jin <[email protected]>
1 parent 66f7dbc commit 176de8f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/scheduler/cache/cache.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -825,22 +825,26 @@ func (sc *SchedulerCache) processBindTask() {
825825

826826
func (sc *SchedulerCache) BindTask() {
827827
klog.V(5).Infof("batch bind task count %d", len(sc.bindCache))
828+
successfulTasks := make([]*schedulingapi.TaskInfo, 0)
828829
for _, task := range sc.bindCache {
829830
if err := sc.VolumeBinder.BindVolumes(task, task.PodVolumes); err != nil {
830831
klog.Errorf("task %s/%s bind Volumes failed: %#v", task.Namespace, task.Name, err)
831832
sc.VolumeBinder.RevertVolumes(task, task.PodVolumes)
832833
sc.resyncTask(task)
833-
return
834+
} else {
835+
successfulTasks = append(successfulTasks, task)
836+
klog.V(5).Infof("task %s/%s bind Volumes done", task.Namespace, task.Name)
834837
}
835838
}
836839

837-
bindTasks := make([]*schedulingapi.TaskInfo, len(sc.bindCache))
838-
copy(bindTasks, sc.bindCache)
840+
bindTasks := make([]*schedulingapi.TaskInfo, len(successfulTasks))
841+
copy(bindTasks, successfulTasks)
839842
if err := sc.Bind(bindTasks); err != nil {
843+
klog.Errorf("failed to bind task count %d: %#v", len(bindTasks), err)
840844
return
841845
}
842846

843-
for _, task := range sc.bindCache {
847+
for _, task := range successfulTasks {
844848
metrics.UpdateTaskScheduleDuration(metrics.Duration(task.Pod.CreationTimestamp.Time))
845849
}
846850

0 commit comments

Comments
 (0)