chia7712 commented on code in PR #826:
URL: https://github.com/apache/yunikorn-k8shim/pull/826#discussion_r1578419484
##########
pkg/cache/context.go:
##########
@@ -681,17 +681,13 @@ func (ctx *Context) IsPodFitNodeViaPreemption(name, node
string, allocations []s
// look up each victim in the scheduler cache
victims := make([]*v1.Pod, 0)
for _, uid := range allocations {
- if victim, ok :=
ctx.schedulerCache.GetPodNoLock(uid); ok {
- victims = append(victims, victim)
- } else {
- // if pod isn't found, add a
placeholder so that the list is still the same size
- victims = append(victims, nil)
- }
+ victim, _ :=
ctx.schedulerCache.GetPodNoLock(uid)
+ victims = append(victims, victim)
}
// check predicates for a match
- if index, ok :=
ctx.predManager.PreemptionPredicates(pod, targetNode, victims, startIndex); ok {
- return index, ok
+ if index, _ :=
ctx.predManager.PreemptionPredicates(pod, targetNode, victims, startIndex);
index != -1 {
Review Comment:
It seems `-1` is equal to "failure". Maybe we don't return extra `boolean`
value.
##########
pkg/cache/context.go:
##########
@@ -681,17 +681,13 @@ func (ctx *Context) IsPodFitNodeViaPreemption(name, node
string, allocations []s
// look up each victim in the scheduler cache
victims := make([]*v1.Pod, 0)
Review Comment:
Could we set the size?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]