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


##########
pkg/cache/context.go:
##########
@@ -682,6 +683,28 @@ func (ctx *Context) EventsToRegister(queueingHintFn 
fwk.QueueingHintFn) []fwk.Cl
        return ctx.predManager.EventsToRegister(queueingHintFn)
 }
 
+// Prefilter evaluates given prefilter based predicates based on current 
context
+func (ctx *Context) Prefilter(name string, allocate bool) 
(map[string]struct{}, error) {
+       ctx.lock.RLock()
+       defer ctx.lock.RUnlock()
+       pod := ctx.schedulerCache.GetPod(name)
+       if pod == nil {
+               return map[string]struct{}{}, ErrorPodNotFound
+       }
+       // if pod exists in cache, try to run predicates
+       // need to lock cache here as predicates need a stable view into the 
cache
+       ctx.schedulerCache.LockForReads()
+       plugin, feasibleNodes, cycleState, err := 
ctx.predManager.PreFilter(pod, allocate)
+       ctx.schedulerCache.UnlockForReads()
+       ctx.schedulerCache.UpdateCycleState(pod, cycleState)

Review Comment:
   Taken care.
   
   But wondering why predicates manager requires stable view of the cache? Need 
to take a deep look at this exisitng comment
   
   `// need to lock cache here as predicates need a stable view into the cache`



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