craigcondit commented on code in PR #957:
URL: https://github.com/apache/yunikorn-core/pull/957#discussion_r1735123854


##########
pkg/scheduler/objects/allocation.go:
##########
@@ -565,3 +567,39 @@ func (a *Allocation) setUserQuotaCheckPassed() {
                a.askEvents.SendRequestFitsInUserQuota(a.allocationKey, 
a.applicationID, a.allocatedResource)
        }
 }
+
+func (a *Allocation) setPreemptionPreConditionsCheckPassed() {
+       a.Lock()
+       defer a.Unlock()
+       if a.preemptionPreConditionsCheckFailed {
+               a.preemptionPreConditionsCheckFailed = false
+               
a.askEvents.SendPreemptionPreConditionsCheckPassed(a.allocationKey, 
a.applicationID, a.allocatedResource)
+       }
+}
+
+func (a *Allocation) setPreemptionPreConditionsCheckFailed() {
+       a.Lock()
+       defer a.Unlock()
+       if !a.preemptionPreConditionsCheckFailed {
+               a.preemptionPreConditionsCheckFailed = true
+               
a.askEvents.SendPreemptionPreConditionsCheckFailed(a.allocationKey, 
a.applicationID, a.allocatedResource)
+       }
+}
+
+func (a *Allocation) setPreemptionQueueGuaranteesCheckPassed() {
+       a.Lock()
+       defer a.Unlock()
+       if a.preemptionQueueGuaranteesCheckFailed {
+               a.preemptionQueueGuaranteesCheckFailed = false
+               
a.askEvents.SendPreemptionQueueGuaranteesCheckPassed(a.allocationKey, 
a.applicationID, a.allocatedResource)
+       }
+}
+
+func (a *Allocation) setPreemptionQueueGuaranteesCheckFailed() {
+       a.Lock()
+       defer a.Unlock()
+       if !a.preemptionQueueGuaranteesCheckFailed {
+               a.preemptionQueueGuaranteesCheckFailed = true
+               
a.askEvents.SendPreemptionQueueGuaranteesCheckFailed(a.allocationKey, 
a.applicationID, a.allocatedResource)
+       }
+}

Review Comment:
   I agree we should not send events except in these cases:
   
   Request pod: "Preempting pod {namespace}/{pod} to make room"  (there could 
be multiple of these if we preempt multiple pods)
   
   Victim pods: "Preempting pod to make room for {namespace}/{pod}" (only one 
of these per victim)
   
   This allows users to see that their pod triggered preemption, or that their 
pod was preempted and by whom.
   



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