Skip to content

Commit

Permalink
deadLock for lastScheduleTime
Browse files Browse the repository at this point in the history
Signed-off-by: wangjianyu.wjy <wangjianyu.wjy@alibaba-inc.com>
  • Loading branch information
wangjianyu.wjy committed Apr 10, 2024
1 parent 0e1ec3e commit 871c5f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 0 additions & 9 deletions pkg/scheduler/plugins/coscheduling/core/gang.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,6 @@ func (gang *Gang) setScheduleCycleValid(valid bool) {
gang.lock.Lock()
defer gang.lock.Unlock()

if !valid && !gang.ScheduleCycleValid {
/*
let's explain why by following example, there are three gang of one group: A, B and C, every gang group have min-member of 10 pod, noted as A1-A10, B1-B10, C1-C10.
1. A1-A5 assumed in gangA scheduleCycle 1, B1-B5 assumed in gangA scheduleCycle 1, C1-C5 assumed in gangA scheduleCycle 1, C7 filter failed due to insufficient resource, then A6-10 failed due to cycle invalid, C6-C10 failed due to cycle invalid, B6-B9 failed due to cycle invalid
2. A1-A5 assumed in gangA scheduleCycle 2, C1-C5 assumed in gangA scheduleCycle 2, C7 failed due to insufficient resource and gangA\B\C cycle set to invalid,
3. then B10 failed due to cycle invalid, B1 comes and find its gang scheduling cycle 2 can be valid, so it's assumed. however, we expect B1 should fail because schedule cycle 2 already failed.
*/
gang.ScheduleCycle += 1
}
gang.ScheduleCycleValid = valid
klog.Infof("SetScheduleCycleValid, gangName: %v, valid: %v", gang.Name, valid)
}
Expand Down
16 changes: 13 additions & 3 deletions pkg/scheduler/plugins/coscheduling/coscheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ func TestFairness(t *testing.T) {
"gangI": {"default/gangH", "default/gangI", "default/gangJ"},
"gangJ": {"default/gangH", "default/gangI", "default/gangJ"},
}
gangMinRequiredNums := []int{20, 10, 32, 4, 5, 18, 43, 20, 30, 20}
gangMinRequiredNums := []int{20, 10, 32, 20, 20, 18, 43, 20, 30, 20}
gangInjectFilterError := []bool{false, false, true, false, false, true, true, false, false, true}
var gangInjectFilterErrorIndex []int
for _, gangMinRequiredNum := range gangMinRequiredNums {
Expand Down Expand Up @@ -1010,6 +1010,16 @@ func TestFairness(t *testing.T) {
for i := 0; i < 3; i++ {
for j := 0; j < len(allPods); j++ {
simulateScheduleOne(t, ctx, sched, suit, &scheduleOrder, func(pod *corev1.Pod) bool {
if gangName := util.GetGangNameByPod(pod); gangName == "gangD" || gangName == "gangE" {
waitingPod := 0
suit.Handle.IterateOverWaitingPods(func(pod framework.WaitingPod) {
podScheduleInfo := suit.plugin.(*Coscheduling).pgMgr.GetPodScheduleInfo(pod.GetPod())
if podScheduleInfo != nil && !podScheduleInfo.GetAlreadyBeenRejected() {
waitingPod++
}
})
return waitingPod >= 40
}
return pod.Labels["filterError"] == "true"
})
}
Expand All @@ -1019,13 +1029,13 @@ func TestFairness(t *testing.T) {
suit.Handle.IterateOverWaitingPods(func(pod framework.WaitingPod) {
waitingPodNum++
})
assert.LessOrEqual(t, len(allPods)-gangMinRequiredNums[3]-gangMinRequiredNums[4], len(sched.SchedulingQueue.PendingPods())+waitingPodNum)
minGangSchedulingCycle, maxGangSchedulingCycle := math.MaxInt, 0
gangSummaries := suit.plugin.(*Coscheduling).pgMgr.GetGangSummaries()

nonZeroWaitingBoundGroup := map[string]bool{}
for _, gangSummary := range gangSummaries {
if gangSummary.OnceResourceSatisfied {
if gangSummary.Name == "default/gangD" || gangSummary.Name == "default/gangE" {
assert.True(t, gangSummary.OnceResourceSatisfied)
assert.Zero(t, len(gangSummary.WaitingForBindChildren))
continue
}
Expand Down

0 comments on commit 871c5f7

Please sign in to comment.