FrankYang0529 commented on code in PR #571:
URL: https://github.com/apache/yunikorn-core/pull/571#discussion_r1233850857


##########
pkg/scheduler/objects/events.go:
##########
@@ -50,6 +51,71 @@ func (evt *applicationEvents) sendPlaceholderLargerEvent(ph 
*Allocation, request
        evt.eventSystem.AddEvent(event)
 }
 
+func (evt *applicationEvents) sendNewAllocationEvent(alloc *Allocation) {
+       if !evt.enabled {
+               return
+       }
+
+       event := events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_ADD, si.EventRecord_APP_ALLOC, 
alloc.GetAllocatedResource())
+       evt.eventSystem.AddEvent(event)
+}
+
+func (evt *applicationEvents) sendNewAskEvent(request *AllocationAsk) {
+       if !evt.enabled {
+               return
+       }
+
+       event := events.CreateAppEventRecord(evt.app.ApplicationID, "", 
request.GetAllocationKey(), si.EventRecord_ADD, si.EventRecord_APP_REQUEST, 
request.GetAllocatedResource())
+       evt.eventSystem.AddEvent(event)
+}
+
+func (evt *applicationEvents) sendRemoveAllocationEvent(alloc *Allocation, 
terminationType si.TerminationType) {
+       if !evt.enabled {
+               return
+       }
+
+       var event *si.EventRecord
+       switch terminationType {
+       case si.TerminationType_UNKNOWN_TERMINATION_TYPE:
+               event = events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_REMOVE, si.EventRecord_ALLOC_NODEREMOVED, 
alloc.GetAllocatedResource())
+       case si.TerminationType_STOPPED_BY_RM:
+               event = events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_REMOVE, si.EventRecord_ALLOC_CANCEL, 
alloc.GetAllocatedResource())
+       case si.TerminationType_TIMEOUT:
+               event = events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_REMOVE, si.EventRecord_ALLOC_TIMEOUT, 
alloc.GetAllocatedResource())
+       case si.TerminationType_PREEMPTED_BY_SCHEDULER:
+               event = events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_REMOVE, si.EventRecord_ALLOC_PREEMPT, 
alloc.GetAllocatedResource())
+       case si.TerminationType_PLACEHOLDER_REPLACED:
+               event = events.CreateAppEventRecord(evt.app.ApplicationID, "", 
alloc.GetUUID(), si.EventRecord_REMOVE, si.EventRecord_ALLOC_REPLACED, 
alloc.GetAllocatedResource())
+       }
+
+       evt.eventSystem.AddEvent(event)
+}
+
+func (evt *applicationEvents) sendRemoveAskEvent(request *AllocationAsk, 
terminationType si.TerminationType) {

Review Comment:
   Yeah, I see. The application removal event is in ticket 1800.
   <img width="643" alt="截圖 2023-06-19 下午6 16 45" 
src="https://github.com/apache/yunikorn-core/assets/4927361/d865b227-d3da-4326-b39f-3b836ad290bc";>
   But there is another event for asks which is trigger by application removal.
   <img width="642" alt="截圖 2023-06-19 下午6 17 37" 
src="https://github.com/apache/yunikorn-core/assets/4927361/6be866c7-1997-43e6-abb7-79cf38ba5ea0";>
   



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