@@ -825,22 +825,26 @@ func (sc *SchedulerCache) processBindTask() {
825
825
826
826
func (sc * SchedulerCache ) BindTask () {
827
827
klog .V (5 ).Infof ("batch bind task count %d" , len (sc .bindCache ))
828
+ successfulTasks := make ([]* schedulingapi.TaskInfo , 0 )
828
829
for _ , task := range sc .bindCache {
829
830
if err := sc .VolumeBinder .BindVolumes (task , task .PodVolumes ); err != nil {
830
831
klog .Errorf ("task %s/%s bind Volumes failed: %#v" , task .Namespace , task .Name , err )
831
832
sc .VolumeBinder .RevertVolumes (task , task .PodVolumes )
832
833
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 )
834
837
}
835
838
}
836
839
837
- bindTasks := make ([]* schedulingapi.TaskInfo , len (sc . bindCache ))
838
- copy (bindTasks , sc . bindCache )
840
+ bindTasks := make ([]* schedulingapi.TaskInfo , len (successfulTasks ))
841
+ copy (bindTasks , successfulTasks )
839
842
if err := sc .Bind (bindTasks ); err != nil {
843
+ klog .Errorf ("failed to bind task count %d: %#v" , len (bindTasks ), err )
840
844
return
841
845
}
842
846
843
- for _ , task := range sc . bindCache {
847
+ for _ , task := range successfulTasks {
844
848
metrics .UpdateTaskScheduleDuration (metrics .Duration (task .Pod .CreationTimestamp .Time ))
845
849
}
846
850
0 commit comments