From 7a0c6c0637a5925973847954ec61466b9edc1e2e Mon Sep 17 00:00:00 2001 From: lowang-bh Date: Thu, 17 Aug 2023 17:36:38 +0800 Subject: [PATCH] enhancement: don't need to re-calculate job's allocated resource Signed-off-by: lowang-bh --- pkg/scheduler/plugins/overcommit/overcommit.go | 3 +-- pkg/scheduler/plugins/proportion/proportion.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/scheduler/plugins/overcommit/overcommit.go b/pkg/scheduler/plugins/overcommit/overcommit.go index a8ca5b2a63..594734cac9 100644 --- a/pkg/scheduler/plugins/overcommit/overcommit.go +++ b/pkg/scheduler/plugins/overcommit/overcommit.go @@ -101,8 +101,7 @@ func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) { if job.PodGroup.Status.Phase == scheduling.PodGroupRunning && job.PodGroup.Spec.MinResources != nil && int32(util.CalculateAllocatedTaskNum(job)) >= job.PodGroup.Spec.MinMember { - allocated := util.GetAllocatedResource(job) - inqueued := util.GetInqueueResource(job, allocated) + inqueued := util.GetInqueueResource(job, job.Allocated) op.inqueueResource.Add(inqueued) } } diff --git a/pkg/scheduler/plugins/proportion/proportion.go b/pkg/scheduler/plugins/proportion/proportion.go index 44fb56274a..5baf64a7f5 100644 --- a/pkg/scheduler/plugins/proportion/proportion.go +++ b/pkg/scheduler/plugins/proportion/proportion.go @@ -151,8 +151,7 @@ func (pp *proportionPlugin) OnSessionOpen(ssn *framework.Session) { if job.PodGroup.Status.Phase == scheduling.PodGroupRunning && job.PodGroup.Spec.MinResources != nil && int32(util.CalculateAllocatedTaskNum(job)) >= job.PodGroup.Spec.MinMember { - allocated := util.GetAllocatedResource(job) - inqueued := util.GetInqueueResource(job, allocated) + inqueued := util.GetInqueueResource(job, job.Allocated) attr.inqueue.Add(inqueued) } attr.elastic.Add(job.GetElasticResources())