pbacsko commented on code in PR #581:
URL: https://github.com/apache/yunikorn-core/pull/581#discussion_r1266469406
##########
pkg/scheduler/objects/application.go:
##########
@@ -198,9 +200,18 @@ func NewApplication(siApp *si.AddApplicationRequest, ugi
security.UserGroup, eve
app.rmEventHandler = eventHandler
app.rmID = rmID
app.appEvents = newApplicationEvents(app, events.GetEventSystem())
+ app.appEvents.sendNewApplicationEvent()
return app
}
+func (sa *Application) SetEnableAppStateEvent(enable bool) {
+ sa.enableAppStateEvent = enable
+}
+
+func (sa *Application) ResetAppEvents() {
+ sa.appEvents = newApplicationEvents(sa, events.GetEventSystem())
+}
Review Comment:
Do not export these two methods. In fact, these are only called from unit
tests, so I suggest that you move them, to `application_test.go` (see examples
like `addPlaceholderDataWithLocking()`, `handleApplicationEventWithLocking()`).
Obviously `enableAppStateEvent` must stay as a member variable.
##########
pkg/scheduler/objects/application.go:
##########
@@ -198,9 +200,18 @@ func NewApplication(siApp *si.AddApplicationRequest, ugi
security.UserGroup, eve
app.rmEventHandler = eventHandler
app.rmID = rmID
app.appEvents = newApplicationEvents(app, events.GetEventSystem())
+ app.appEvents.sendNewApplicationEvent()
return app
}
+func (sa *Application) SetEnableAppStateEvent(enable bool) {
+ sa.enableAppStateEvent = enable
+}
+
+func (sa *Application) ResetAppEvents() {
+ sa.appEvents = newApplicationEvents(sa, events.GetEventSystem())
+}
Review Comment:
Do not export these two methods. In fact, these are only called from unit
tests, so I suggest that you move them to `application_test.go` (see examples
like `addPlaceholderDataWithLocking()`, `handleApplicationEventWithLocking()`).
Obviously `enableAppStateEvent` must stay as a member variable.
--
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]