ryankert01 commented on code in PR #826:
URL: https://github.com/apache/yunikorn-k8shim/pull/826#discussion_r1578441808


##########
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 looks like we can refactor PreemptionPredicates(). I will file a jira for 
it.



-- 
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]

Reply via email to