wilfred-s commented on a change in pull request #397:
URL: https://github.com/apache/yunikorn-core/pull/397#discussion_r837996818



##########
File path: pkg/scheduler/objects/application.go
##########
@@ -53,6 +53,11 @@ const (
        AppTagStateAwareDisable string = "application.stateaware.disable"
 )
 
+type EventLogEntry struct {
+       EventTime        time.Time
+       ApplicationState string
+}

Review comment:
       This should be called StateLogEntry, we log state changes not every 
event. 

##########
File path: pkg/scheduler/objects/application.go
##########
@@ -142,6 +149,20 @@ func (sa *Application) SetState(state string) {
        sa.stateMachine.SetState(state)
 }
 
+func (sa *Application) recordEvent(time time.Time, appState string, prevState 
string) {

Review comment:
       signature cleanup:
   * time is always passed in as time.Now(), we can set it here. The nano 
second differences are not important.
   * prevState is not used as the ordering provides the previous state already

##########
File path: pkg/scheduler/objects/application.go
##########
@@ -80,6 +85,7 @@ type Application struct {
        gangSchedulingStyle  string                 // gang scheduling style 
can be hard (after timeout we fail the application), or soft (after timeeout we 
schedule it as a normal application)
        finishedTime         time.Time              // the time of finishing 
this application. the default value is zero time
        rejectedMessage      string                 // If the application is 
rejected, save the rejected message
+       eventLog             []*EventLogEntry       // event log for this 
application

Review comment:
       This should be called stateLog

##########
File path: pkg/scheduler/objects/application.go
##########
@@ -281,6 +303,9 @@ func (sa *Application) timeoutStateTimer(expectedState 
string, event application
                                sa.notifyRMAllocationReleased(sa.rmID, 
toRelease, si.TerminationType_TIMEOUT, "releasing placeholders on app complete")
                                sa.clearStateTimer()
                        } else {
+                               // HandleApplicationEvent assumes the lock to 
be held
+                               sa.Lock()
+                               defer sa.Unlock()

Review comment:
       We have two choices: 
   1. move adding this lock and a lock review of `timeoutStateTimer()` to a new 
jira., or
   2. fix all locking issues here: `getPlaceholderAllocations()` accesses the 
allocations map unlocked which might cause issues. `clearStateTimer()` in all 
cases but here is called under lock.
   We discussed the `clearStateTimer()` call yesterday and I am not sure it 
causes a problem but we might as well be careful.




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