Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #660 from TommyLike/bug/fix_sub_error
Browse files Browse the repository at this point in the history
Fix Resource Sub exception in Reclaim&Preempt Actions
  • Loading branch information
k8s-ci-robot authored Mar 27, 2019
2 parents e511be2 + 7f767c8 commit 40070d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/scheduler/actions/preempt/preempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ func preempt(
}
preempted.Add(preemptee.Resreq)
// If reclaimed enough resources, break loop to avoid Sub panic.
if resreq.LessEqual(preemptee.Resreq) {
if resreq.LessEqual(preempted) {
break
}
resreq.Sub(preemptee.Resreq)
}

metrics.RegisterPreemptionAttempts()
Expand Down
3 changes: 1 addition & 2 deletions pkg/scheduler/actions/reclaim/reclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ func (alloc *reclaimAction) Execute(ssn *framework.Session) {
}
reclaimed.Add(reclaimee.Resreq)
// If reclaimed enough resources, break loop to avoid Sub panic.
if resreq.LessEqual(reclaimee.Resreq) {
if resreq.LessEqual(reclaimed) {
break
}
resreq.Sub(reclaimee.Resreq)
}

glog.V(3).Infof("Reclaimed <%v> for task <%s/%s> requested <%v>.",
Expand Down

0 comments on commit 40070d3

Please sign in to comment.