yangwwei commented on a change in pull request #128: URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/128#discussion_r445311398
########## File path: pkg/callback/scheduler_callback.go ########## @@ -143,3 +144,35 @@ func (callback *AsyncRMCallback) ReSyncSchedulerCache(args *si.ReSyncSchedulerCa } return nil } + +// this callback implement scheduler plugin interface EventPlugin. +func (callback *AsyncRMCallback) SendEvent(eventRecords []*si.EventRecord) error { + errors := make([]string, 0) + if len(eventRecords) > 0 { + log.Logger.Debug(fmt.Sprintf("processing %d events", len(eventRecords))) + for _, record := range eventRecords { + reason := record.Reason + msg := record.Message + + switch record.Type { + case si.EventRecord_REQUEST: + taskID := record.ObjectID + appID := record.GroupID + app := callback.context.GetApplication(appID) + + err := cache.PublishTaskEvent(taskID, reason, msg, app) + if err != nil { + errors = append(errors, err.Error()) + } + log.Logger.Debug("event emitted") + case si.EventRecord_APP: + // until we don't have app CRD let's expose app event to all its pods (asks) + // pending on YUNIKORN-170 + errors = append(errors, fmt.Sprintf("processing app event is not implemented yet: %s", record)) Review comment: agree ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org