kingamarton commented on a change in pull request #250:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/250#discussion_r588216730



##########
File path: pkg/scheduler/objects/application.go
##########
@@ -1103,11 +1177,19 @@ func (sa *Application) removeAllocationInternal(uuid 
string) *Allocation {
                sa.allocatedResource = resources.Sub(sa.allocatedResource, 
alloc.AllocatedResource)
        }
        // When the resource trackers are zero we should not expect anything to 
come in later.
-       if resources.IsZero(sa.pending) && 
resources.IsZero(sa.allocatedResource) && 
resources.IsZero(sa.allocatedPlaceholder) {
-               if err := sa.HandleApplicationEvent(WaitApplication); err != 
nil {
-                       log.Logger().Warn("Application state not changed to 
Waiting while removing some allocation(s)",
-                               zap.String("currentState", sa.CurrentState()),
-                               zap.Error(err))
+       if resources.IsZero(sa.pending) && 
resources.IsZero(sa.allocatedResource) {
+               if sa.isWaitingStateTimedOut() && 
resources.IsZero(sa.allocatedPlaceholder) {
+                       if err := 
sa.HandleApplicationEvent(CompleteApplication); err != nil {
+                               log.Logger().Warn("Application state not 
changed to Completed while removing some allocation(s)",
+                                       zap.String("currentState", 
sa.CurrentState()),
+                                       zap.Error(err))
+                       }
+               } else {
+                       if err := sa.HandleApplicationEvent(WaitApplication); 
err != nil {
+                               log.Logger().Warn("Application state not 
changed to Waiting while removing some allocation(s)",
+                                       zap.String("currentState", 
sa.CurrentState()),
+                                       zap.Error(err))
+                       }

Review comment:
       We had a sync with @yangwwei and we decided to simplify this one as he 
suggested, and after we have some feedback we can enhance it in the future.




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