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



##########
File path: pkg/callback/scheduler_callback.go
##########
@@ -118,15 +118,34 @@ func (callback *AsyncRMCallback) 
RecvUpdateResponse(response *si.UpdateResponse)
        for _, release := range response.ReleasedAllocations {
                log.Logger().Debug("callback: response to released allocations",
                        zap.String("UUID", release.UUID))
+               // delete the allocated pod
+               app := callback.context.GetApplication(release.ApplicartionID)

Review comment:
       Need to check if app is nil or not, to avoid nil pointer exception

##########
File path: pkg/callback/scheduler_callback.go
##########
@@ -118,15 +118,34 @@ func (callback *AsyncRMCallback) 
RecvUpdateResponse(response *si.UpdateResponse)
        for _, release := range response.ReleasedAllocations {
                log.Logger().Debug("callback: response to released allocations",
                        zap.String("UUID", release.UUID))
+               // delete the allocated pod
+               app := callback.context.GetApplication(release.ApplicartionID)
+               for _, task := range app.taskMap {
+                       if task.allocationUUID == release.UUID {
+                               // TerminationType 0 mean STOPPED_BY_RM
+                               if release.TerminationType != 
si.AllocationRelease_STOPPED_BY_RM {

Review comment:
       we need to handle this check before iterating the task map in order to 
make this more efficient




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