From eff0a1fc94f99c442d3000fe42dc3d1700afbaac Mon Sep 17 00:00:00 2001 From: Manikandan R Date: Tue, 20 Aug 2024 11:05:19 +0530 Subject: [PATCH] [YUNIKORN-2803] Use FitIn for node check (#945) Closes: #945 Signed-off-by: Manikandan R --- pkg/scheduler/objects/preemption.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/scheduler/objects/preemption.go b/pkg/scheduler/objects/preemption.go index 40190fe4e..73f24bae4 100644 --- a/pkg/scheduler/objects/preemption.go +++ b/pkg/scheduler/objects/preemption.go @@ -213,7 +213,6 @@ func (p *Preemptor) checkPreemptionQueueGuarantees() bool { //nolint:funlen func (p *Preemptor) calculateVictimsByNode(nodeAvailable *resources.Resource, potentialVictims []*Allocation) (int, []*Allocation) { nodeCurrentAvailable := nodeAvailable.Clone() - allocationsByQueueSnap := p.duplicateQueueSnapshots() // Initial check: Will allocation fit on node without preemption? This is possible if preemption was triggered due // to queue limits and not node resource limits. @@ -222,6 +221,7 @@ func (p *Preemptor) calculateVictimsByNode(nodeAvailable *resources.Resource, po return -1, make([]*Allocation, 0) } + allocationsByQueueSnap := p.duplicateQueueSnapshots() // get the current queue snapshot askQueue, ok := allocationsByQueueSnap[p.queuePath] if !ok { @@ -326,7 +326,7 @@ func (p *Preemptor) calculateVictimsByNode(nodeAvailable *resources.Resource, po // removing task does not violate queue constraints, adjust queue and node nodeCurrentAvailable.AddTo(victim.GetAllocatedResource()) // check if ask now fits and we haven't had this happen before - if nodeCurrentAvailable.FitInMaxUndef(p.ask.GetAllocatedResource()) && index < 0 { + if nodeCurrentAvailable.FitIn(p.ask.GetAllocatedResource()) && index < 0 { index = len(results) } // add victim to results