kingamarton commented on a change in pull request #245:
URL: 
https://github.com/apache/incubator-yunikorn-k8shim/pull/245#discussion_r597005030



##########
File path: pkg/cache/application.go
##########
@@ -507,6 +514,19 @@ func (app *Application) 
handleCompleteApplicationEvent(event *fsm.Event) {
        // TODO app lifecycle updates
 }
 
+func (app *Application) handleFailApplicationEvent(event *fsm.Event) {
+       // unallocated task states include New, Pending and Scheduling
+       unalloc := app.GetNewTasks()
+       unalloc = append(unalloc, app.GetPendingTasks()...)
+       unalloc = append(unalloc, app.GetSchedulingTask()...)

Review comment:
       You have a deadlock here, because the application is already locked: 
https://github.com/apache/incubator-yunikorn-k8shim/blob/master/pkg/cache/application.go#L153-L155

##########
File path: pkg/cache/application.go
##########
@@ -507,6 +514,19 @@ func (app *Application) 
handleCompleteApplicationEvent(event *fsm.Event) {
        // TODO app lifecycle updates
 }
 
+func (app *Application) handleFailApplicationEvent(event *fsm.Event) {
+       // unallocated task states include New, Pending and Scheduling
+       unalloc := app.GetNewTasks()
+       unalloc = append(unalloc, app.GetPendingTasks()...)
+       unalloc = append(unalloc, app.GetSchedulingTask()...)

Review comment:
       You can simply use `unalloc := app.getTasks(events.States().Task.New)` 
...




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