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


##########
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:
   Sorry, I thought we were deleting the cycle state in case of successful 
Filter calls, but thats not the case. We should wrap the delete operation 
inside nil err check. Does that sounds good?



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