Skip to content

Commit e205e70

Browse files
authored
reduce status update freq (#276)
1 parent f52b39c commit e205e70

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CONTROLLER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.29.51
1+
1.29.52

pkg/controller/queuejob/queuejob_controller_ex.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,15 @@ func (qjm *XController) PreemptQueueJobs() {
438438
cleanAppWrapper := false
439439

440440
if (aw.Status.Running + aw.Status.Succeeded) < int32(aw.Spec.SchedSpec.MinAvailable) {
441-
message = fmt.Sprintf("Insufficient number of Running and Completed pods, minimum=%d, running=%d, completed=%d.", aw.Spec.SchedSpec.MinAvailable, aw.Status.Running, aw.Status.Succeeded)
442-
cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", message)
443-
newjob.Status.Conditions = append(newjob.Status.Conditions, cond)
441+
index := getIndexOfMatchedCondition(aw, arbv1.AppWrapperCondPreemptCandidate, "MinPodsNotRunning")
442+
if index < 0 {
443+
message = fmt.Sprintf("Insufficient number of Running and Completed pods, minimum=%d, running=%d, completed=%d.", aw.Spec.SchedSpec.MinAvailable, aw.Status.Running, aw.Status.Succeeded)
444+
cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", message)
445+
newjob.Status.Conditions = append(newjob.Status.Conditions, cond)
446+
} else {
447+
cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", "")
448+
newjob.Status.Conditions[index] = *cond.DeepCopy()
449+
}
444450

445451
if aw.Spec.SchedSpec.Requeuing.GrowthType == "exponential" {
446452
newjob.Spec.SchedSpec.Requeuing.TimeInSeconds += aw.Spec.SchedSpec.Requeuing.TimeInSeconds

0 commit comments

Comments
 (0)