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



##########
File path: pkg/scheduler/objects/application.go
##########
@@ -172,37 +186,41 @@ func (sa *Application) OnStateChange(event *fsm.Event) {
 // Set the starting timer to make sure the application will not get stuck in a 
starting state too long.
 // This prevents an app from not progressing to Running when it only has 1 
allocation.
 // Called when entering the Starting state by the state machine.
-func (sa *Application) SetStartingTimer() {
-       log.Logger().Debug("Application Starting state timer initiated",
+func (sa *Application) setStateTimer(timeout time.Duration, currentState 
string, event applicationEvent) {
+       log.Logger().Debug("Application state timer initiated",
                zap.String("appID", sa.ApplicationID),
-               zap.Duration("timeout", startingTimeout))
-       sa.stateTimer = time.AfterFunc(startingTimeout, sa.timeOutStarting)
+               zap.String("state", sa.stateMachine.Current()),
+               zap.Any("timeout", timeout))

Review comment:
       Can we use `zap.Duration()` for this log entry?

##########
File path: pkg/scheduler/partition.go
##########
@@ -1208,3 +1219,11 @@ func (pc *PartitionContext) removeAllocationAsk(appID 
string, allocationKey stri
                }
        }
 }
+
+func (pc *PartitionContext) cleanupExpiredApps() {

Review comment:
       The `PartitionManager` is a different go routine. That means the delete 
below can cause a race condition.
   We either need to lock around the delete or make the function locked. I 
think speed wise we should just lock around the delete.

##########
File path: pkg/scheduler/partition.go
##########
@@ -1208,3 +1219,11 @@ func (pc *PartitionContext) removeAllocationAsk(appID 
string, allocationKey stri
                }
        }
 }
+
+func (pc *PartitionContext) cleanupExpiredApps() {
+       for _, app := range pc.GetAppsByState(objects.Expired.String()) {
+               if app.IsMarkedForRemoval() {

Review comment:
       I think we still need to remove that line.




----------------------------------------------------------------
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:
[email protected]


Reply via email to