@@ -419,32 +419,27 @@ func NewJobController(config *rest.Config, serverOption *options.ServerOption) *
419419
420420func (qjm * XController ) PreemptQueueJobs () {
421421qjobs := qjm .GetQueueJobsEligibleForPreemption ()
422- var updateNewJob * arbv1.AppWrapper
423- var message string
424422for _ , 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 {
428427continue
429- }
430- newjob .Status .CanRun = false
431-
428+ }
429+ newjob .Status .CanRun = false
430+
431+ if aw .Status .Running < int32 (aw .Spec .SchedSpec .MinAvailable ) {
432432message = fmt .Sprintf ("Insufficient number of Running pods, minimum=%d, running=%v." , aw .Spec .SchedSpec .MinAvailable , aw .Status .Running )
433433cond := GenerateAppWrapperCondition (arbv1 .AppWrapperCondPreemptCandidate , v1 .ConditionTrue , "MinPodsNotRunning" , message )
434434newjob .Status .Conditions = append (newjob .Status .Conditions , cond )
435435updateNewJob = 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
446439message = fmt .Sprintf ("Pods failed scheduling failed=%v, running=%v." , len (aw .Status .PendingPodConditions ), aw .Status .Running )
447440index := 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.
448443if index < 0 {
449444cond := GenerateAppWrapperCondition (arbv1 .AppWrapperCondPreemptCandidate , v1 .ConditionTrue , "PodsFailedScheduling" , message )
450445newjob .Status .Conditions = append (newjob .Status .Conditions , cond )
@@ -461,6 +456,7 @@ func (qjm *XController) PreemptQueueJobs() {
461456klog .V (4 ).Infof ("[PreemptQueueJobs] Adding preempted AppWrapper %s/%s to backoff queue." ,
462457aw .Name , aw .Namespace )
463458go qjm .backoff (aw , "PreemptionTriggered" , string (message ))
459+
464460}
465461}
466462func (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