Skip to content

Commit

Permalink
[YUNIKORN-2803] Use FitIn for node check (#945)
Browse files Browse the repository at this point in the history
Closes: #945

Signed-off-by: Manikandan R <[email protected]>
  • Loading branch information
manirajv06 committed Aug 20, 2024
1 parent 9f46b81 commit eff0a1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/scheduler/objects/preemption.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eff0a1f

Please sign in to comment.