You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2021/03/18 15:57:34 UTC

[GitHub] [incubator-yunikorn-k8shim] kingamarton commented on a change in pull request #245: [YUNIKORN-556]Expose pod level events when an app is failed in scheduling

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:
users@infra.apache.org