pbacsko commented on code in PR #571:
URL: https://github.com/apache/yunikorn-core/pull/571#discussion_r1233898044
##########
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:
Yes, we call `removeAsksInternal("")` in two places. One is the timeout case
(placeholders), the other is when we remove the entire application. You know
the context, just pass this extra info to the `sendRemoveAskEvent()` method.
--
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]