From f3aafddc73bc6b660bf875887d3d7d193471c627 Mon Sep 17 00:00:00 2001 From: asm582 Date: Thu, 16 Feb 2023 09:57:28 -0500 Subject: [PATCH] reduce status update freq --- CONTROLLER_VERSION | 2 +- pkg/controller/queuejob/queuejob_controller_ex.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CONTROLLER_VERSION b/CONTROLLER_VERSION index 971333c39..5d9b3ce52 100644 --- a/CONTROLLER_VERSION +++ b/CONTROLLER_VERSION @@ -1 +1 @@ -1.29.51 +1.29.52 diff --git a/pkg/controller/queuejob/queuejob_controller_ex.go b/pkg/controller/queuejob/queuejob_controller_ex.go index 5654e5d9d..7863002b3 100644 --- a/pkg/controller/queuejob/queuejob_controller_ex.go +++ b/pkg/controller/queuejob/queuejob_controller_ex.go @@ -438,9 +438,15 @@ func (qjm *XController) PreemptQueueJobs() { cleanAppWrapper := false if (aw.Status.Running + aw.Status.Succeeded) < int32(aw.Spec.SchedSpec.MinAvailable) { - 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) - cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", message) - newjob.Status.Conditions = append(newjob.Status.Conditions, cond) + index := getIndexOfMatchedCondition(aw, arbv1.AppWrapperCondPreemptCandidate, "MinPodsNotRunning") + if index < 0 { + 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) + cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", message) + newjob.Status.Conditions = append(newjob.Status.Conditions, cond) + } else { + cond := GenerateAppWrapperCondition(arbv1.AppWrapperCondPreemptCandidate, v1.ConditionTrue, "MinPodsNotRunning", "") + newjob.Status.Conditions[index] = *cond.DeepCopy() + } if aw.Spec.SchedSpec.Requeuing.GrowthType == "exponential" { newjob.Spec.SchedSpec.Requeuing.TimeInSeconds += aw.Spec.SchedSpec.Requeuing.TimeInSeconds