pbacsko commented on code in PR #1043:
URL: https://github.com/apache/yunikorn-k8shim/pull/1043#discussion_r3659112469


##########
pkg/cache/context.go:
##########
@@ -706,9 +739,14 @@ func (ctx *Context) IsPodFitNode(name, node string, 
allocate bool) error {
                return ErrorNodeNotFound
        }
        // need to lock cache here as predicates need a stable view into the 
cache
-       ctx.schedulerCache.LockForReads()
-       defer ctx.schedulerCache.UnlockForReads()
-       plugin, err := ctx.predManager.Predicates(pod, targetNode, allocate)
+       ctx.schedulerCache.LockForWrites()
+       defer ctx.schedulerCache.UnlockForWrites()
+       cycleState := ctx.schedulerCache.GetCycleState(pod)
+       if cycleState == nil {
+               return ErrorCycleStateNotFound
+       }
+       plugin, err := ctx.predManager.Filter(pod, targetNode, cycleState, 
allocate)
+       ctx.schedulerCache.DeleteCycleState(pod)

Review Comment:
   > Why we do need the cycle state once we decide the node?
   
   Isn't this method called from `tryNodes()` where we're iterating though 
nodes?
   
   At this point, we only know that the node is an element of a set of feasible 
nodes. The `Filter()` of a plugin can still fail for a given `targetNode` and 
you have to proceed to the next one. So we can't just delete the `CycleState` 
for a pod here. That must happen later, we we ran out of target nodes.



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