Skip to content

Commit ac4167a

Browse files
authored
Merge branch 'quota-management' into pend_schd
2 parents a5d255a + d728580 commit ac4167a

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

pkg/controller/queuejob/queuejob_controller_ex.go

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -419,32 +419,27 @@ func NewJobController(config *rest.Config, serverOption *options.ServerOption) *
419419

420420
func (qjm *XController) PreemptQueueJobs() {
421421
qjobs := qjm.GetQueueJobsEligibleForPreemption()
422-
var updateNewJob *arbv1.AppWrapper
423-
var message string
424422
for _, aw := range qjobs {
425-
if aw.Status.Running < int32(aw.Spec.SchedSpec.MinAvailable) {
426-
newjob, e := qjm.queueJobLister.AppWrappers(aw.Namespace).Get(aw.Name)
427-
if e != nil {
423+
var updateNewJob *arbv1.AppWrapper
424+
var message string
425+
newjob, e := qjm.queueJobLister.AppWrappers(aw.Namespace).Get(aw.Name)
426+
if e != nil {
428427
continue
429-
}
430-
newjob.Status.CanRun = false
431-
428+
}
429+
newjob.Status.CanRun = false
430+
431+
if aw.Status.Running < int32(aw.Spec.SchedSpec.MinAvailable) {
432432
message = fmt.Sprintf("Insufficient number of Running pods, minimum=%d, running=%v.", aw.Spec.SchedSpec.MinAvailable, aw.Status.Running)
433433
cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", message)
434434
newjob.Status.Conditions = append(newjob.Status.Conditions, cond)
435435
updateNewJob = newjob.DeepCopy()
436436

437437
//If pods failed scheduling generate new preempt condition
438-
//ignore co-scheduler failed scheduling events. This is a temp
439-
//work around until co-scheduler perf issues are resolved.
440438
} else {
441-
newjob, e := qjm.queueJobLister.AppWrappers(aw.Namespace).Get(aw.Name)
442-
if e != nil {
443-
continue
444-
}
445-
newjob.Status.CanRun = false
446439
message = fmt.Sprintf("Pods failed scheduling failed=%v, running=%v.", len(aw.Status.PendingPodConditions), aw.Status.Running)
447440
index := getIndexOfMatchedCondition(newjob, arbv1.AppWrapperCondPreemptCandidate, "PodsFailedScheduling")
441+
//ignore co-scheduler failed scheduling events. This is a temp
442+
//work around until co-scheduler version 0.22.X perf issues are resolved.
448443
if index < 0 {
449444
cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "PodsFailedScheduling", message)
450445
newjob.Status.Conditions = append(newjob.Status.Conditions, cond)
@@ -461,6 +456,7 @@ func (qjm *XController) PreemptQueueJobs() {
461456
klog.V(4).Infof("[PreemptQueueJobs] Adding preempted AppWrapper %s/%s to backoff queue.",
462457
aw.Name, aw.Namespace)
463458
go qjm.backoff(aw, "PreemptionTriggered", string(message))
459+
464460
}
465461
}
466462
func (qjm *XController) preemptAWJobs(preemptAWs []*arbv1.AppWrapper) {
@@ -1935,6 +1931,7 @@ func (cc *XController) Cleanup(appwrapper *arbv1.AppWrapper) error {
19351931
}
19361932
}
19371933
}
1934+
19381935
} else {
19391936
// klog.Infof("[Dispatcher] Cleanup: State=%s\n", appwrapper.Status.State)
19401937
//if ! appwrapper.Status.CanRun && appwrapper.Status.IsDispatched {

0 commit comments

Comments
 (0)