yangwwei commented on a change in pull request #155:
URL: 
https://github.com/apache/incubator-yunikorn-k8shim/pull/155#discussion_r454811431



##########
File path: pkg/cache/context.go
##########
@@ -499,10 +499,49 @@ func (ctx *Context) GetApplication(appID string) 
interfaces.ManagedApp {
 func (ctx *Context) RemoveApplication(appID string) error {
        ctx.lock.Lock()
        defer ctx.lock.Unlock()
-       if _, exist := ctx.applications[appID]; exist {
+       if app, exist := ctx.applications[appID]; exist {
+               var states = events.States().Task
+               for _, task := range app.taskMap {
+                       switch taskState := task.GetTaskState(); taskState {
+                       case states.New:
+                               log.Logger.Warn("Can't remove application 
beacuse task states is New",
+                                       zap.String("taskID", task.GetTaskID()))
+                               return fmt.Errorf("application %s still has 
task in non-terminated", appID)

Review comment:
       Instead of failing once an error is seeing, can we change this to scan 
all the tasks? And then filter out the ones that not in the terminated state, 
then give a detailed error message. Something like: `application % cannot be 
removed because it has non-terminated tasks. Tasks: task1, ... taskN`.




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


Reply via email to