FrankYang0529 commented on code in PR #571:
URL: https://github.com/apache/yunikorn-core/pull/571#discussion_r1232439850


##########
pkg/scheduler/objects/application.go:
##########
@@ -2009,3 +2017,20 @@ func (sa *Application) 
SetTimedOutPlaceholder(taskGroupName string, timedOut int
                sa.placeholderData[taskGroupName].TimedOut = timedOut
        }
 }
+
+func (sa *Application) SendTerminateAllocationAskEvent(allocKey string) {

Review Comment:
   Canceling AllocationAsk cause of removing an application is in 
`PartitionContext.removeApplication`. It calls `app. RemoveAllocationAsk("")`.
   
https://github.com/apache/yunikorn-core/blob/a6a90bb0408a3004592f06d8a79335ac326dcfe4/pkg/scheduler/partition.go#L375-L382
   
   Removing AllocationAsk cause of releasing AllocationAsk request is in 
`PartitionContext.removeAllocation`. It calls 
`app.RemoveAllocationAsk(allocKey)`.
   
https://github.com/apache/yunikorn-core/blob/a6a90bb0408a3004592f06d8a79335ac326dcfe4/pkg/scheduler/partition.go#L1347-L1369
   
   It's not a good idea to check whether `allocKey` is empty in 
`Application.RemoveAllocationAsk` and sent related events, so I export the 
function for `PartitionContext` to use.  I thought about giving another 
argument like 
[TerminationType](https://github.com/apache/yunikorn-scheduler-interface/blob/12c630245d861e48c66841a05117bfc55c00506b/lib/go/si/si.pb.go#L30-L34),
 but we can't tell if the application was removed or the release AllocationAsk 
was sent by the shim.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to