From 91981bf48ee3806dfcab599716fe2e56b87d0cc0 Mon Sep 17 00:00:00 2001 From: wpeng102 Date: Wed, 17 Aug 2022 17:51:44 +0800 Subject: [PATCH] fix performance downgrade issue Signed-off-by: wpeng102 --- pkg/scheduler/actions/allocate/allocate.go | 16 ++++++++++++---- pkg/scheduler/framework/job_updater.go | 6 ------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/scheduler/actions/allocate/allocate.go b/pkg/scheduler/actions/allocate/allocate.go index 16fde70b23..17b47b678c 100644 --- a/pkg/scheduler/actions/allocate/allocate.go +++ b/pkg/scheduler/actions/allocate/allocate.go @@ -21,7 +21,9 @@ import ( "k8s.io/klog" + "volcano.sh/apis/pkg/apis/scheduling" "volcano.sh/volcano/pkg/scheduler/api" + "volcano.sh/volcano/pkg/scheduler/conf" "volcano.sh/volcano/pkg/scheduler/framework" "volcano.sh/volcano/pkg/scheduler/metrics" "volcano.sh/volcano/pkg/scheduler/util" @@ -58,11 +60,17 @@ func (alloc *Action) Execute(ssn *framework.Session) { jobsMap := map[api.NamespaceName]map[api.QueueID]*util.PriorityQueue{} for _, job := range ssn.Jobs { - if job.IsPending() { - klog.V(4).Infof("Job <%s/%s> Queue <%s> skip allocate, reason: job status is pending.", - job.Namespace, job.Name, job.Queue) - continue + // If not config enqueue action, change Pending pg into Inqueue statue to avoid blocking job scheduling. + if !conf.EnabledActionMap["enqueue"] { + job.PodGroup.Status.Phase = scheduling.PodGroupInqueue + } else { + if job.IsPending() { + klog.V(4).Infof("Job <%s/%s> Queue <%s> skip allocate, reason: job status is pending.", + job.Namespace, job.Name, job.Queue) + continue + } } + if vr := ssn.JobValid(job); vr != nil && !vr.Pass { klog.V(4).Infof("Job <%s/%s> Queue <%s> skip allocate, reason: %v, message %v", job.Namespace, job.Name, job.Queue, vr.Reason, vr.Message) continue diff --git a/pkg/scheduler/framework/job_updater.go b/pkg/scheduler/framework/job_updater.go index b44621dc3e..23679138c0 100644 --- a/pkg/scheduler/framework/job_updater.go +++ b/pkg/scheduler/framework/job_updater.go @@ -11,7 +11,6 @@ import ( "volcano.sh/apis/pkg/apis/scheduling" "volcano.sh/volcano/pkg/scheduler/api" - "volcano.sh/volcano/pkg/scheduler/conf" ) const ( @@ -99,11 +98,6 @@ func (ju *jobUpdater) updateJob(index int) { job := ju.jobQueue[index] ssn := ju.ssn - // If not config enqueue action, change Pending pg into Inqueue statue to avoid blocking job scheduling. - if !conf.EnabledActionMap["enqueue"] && job.PodGroup.Status.Phase == scheduling.PodGroupPending { - job.PodGroup.Status.Phase = scheduling.PodGroupInqueue - } - job.PodGroup.Status = jobStatus(ssn, job) oldStatus, found := ssn.podGroupStatus[job.UID] updatePG := !found || isPodGroupStatusUpdated(job.PodGroup.Status, oldStatus)