Skip to content

Commit

Permalink
[YUNIKORN-2795] Handle Preemption cases between two siblings without …
Browse files Browse the repository at this point in the history
…causing preemption loop
  • Loading branch information
manirajv06 committed Aug 21, 2024
1 parent ea20057 commit 3704db9
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 126 deletions.
13 changes: 13 additions & 0 deletions pkg/scheduler/objects/preemption.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package objects

import (
"sort"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -827,6 +828,18 @@ func (qps *QueuePreemptionSnapshot) GetRemainingGuaranteedResource() *resources.
if qps.AskQueue.QueuePath == qps.QueuePath && !remainingGuaranteed.IsEmpty() {
return resources.MergeIfNotPresent(remainingGuaranteed, parent)
}
// Queue (potential victim queue path) being processed currently sharing common ancestors or parent with ask queue should not propagate its
// actual remaining guaranteed to rest of queue's in the queue hierarchy downwards to let them use their own remaining guaranteed only if guaranteed
// has been set. Otherwise, propagating the remaining guaranteed downwards would give wrong perception and those queues might not be chosen
// as victims for sibling ( who is under guaranteed and starving for resources) in the same level.
// Overall, this increases the chance of choosing victims for preemptor from siblings without causing preemption storm or loop.
askQueueRemainingGuaranteed := qps.AskQueue.GuaranteedResource.Clone()
askQueueUsed := qps.AskQueue.AllocatedResource.Clone()
askQueueUsed.SubOnlyExisting(qps.AskQueue.PreemptingResource)

Check failure on line 838 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueUsed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)

Check failure on line 838 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueUsed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)

Check failure on line 838 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueUsed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)

Check failure on line 838 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueUsed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)
askQueueRemainingGuaranteed.SubOnlyExisting(askQueueUsed)

Check failure on line 839 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueRemainingGuaranteed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)) (typecheck)

Check failure on line 839 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueRemainingGuaranteed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting)) (typecheck)

Check failure on line 839 in pkg/scheduler/objects/preemption.go

View workflow job for this annotation

GitHub Actions / build

askQueueRemainingGuaranteed.SubOnlyExisting undefined (type *resources.Resource has no field or method SubOnlyExisting) (typecheck)
if !remainingGuaranteed.IsEmpty() && strings.HasPrefix(qps.AskQueue.QueuePath, qps.QueuePath) && !askQueueRemainingGuaranteed.IsEmpty() {
return nil
}
}
return resources.ComponentWiseMin(remainingGuaranteed, parent)
}
Expand Down
Loading

0 comments on commit 3704db9

Please sign in to comment.