wilfred-s commented on a change in pull request #152:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/152#discussion_r428551379
##########
File path: pkg/cache/application_info.go
##########
@@ -73,6 +73,23 @@ func (ai *ApplicationInfo) GetAllAllocations()
[]*AllocationInfo {
return allocations
}
+// Return the allocation for the allocation key. This will return the first
allocation for the
+// allocation key. It will only work for the case that the repeat is 1.
+func (ai *ApplicationInfo) GetAllocationUUID(allocKey string) string {
+ ai.lock.RLock()
+ defer ai.lock.RUnlock()
+
+ // just get the first one, ignore multiple repeats for now.
+ // we cannot detect multiple repeats easily here.
+ for uuid, alloc := range ai.allocations {
+ if alloc.AllocationProto.AllocationKey == allocKey {
+ return uuid
+ }
+ }
+ // not found return an empty string
+ return ""
+}
+
Review comment:
We have no proper support multiple repeats at the moment.
Let me explain what I think is the problem with multiple repeats and with
what you are proposing in code:
If the asks has multiple repeats we might have allocated one or more of
those repeats. We're currently just link the ask to the allocation. One ask
multiple allocations. Allocations are added and removed based on UUID. So far
all is good.
In this case we are removing an ask. One of the repeats of that ask is in
the process of being allocated. That ask *can* have a number of confirmed
allocations and has at *least* one allocation in flight otherwise we would not
have to clean up where we are. There might be unallocated repeats also but they
are not important.
We need to clean up the in flight allocation that is one allocation. We
cannot just remove all allocations that have been added and confirmed. They
should not be impacted as they are not related to the current change. If those
allocations need to be removed then that is an allocation removal request.
Those earlier allocated ask repeats might have been running for a while and
because an outstanding ask gets deleted I cannot and may not remove confirmed
allocations.
For the case that there are multiple allocation in flight there is a whole
other complexity that needs to be looked at.
In the proposed code of PR #151 you are not only cancelling the inflight
allocation but also all confirmed allocations, that would be an unexpected
behaviour of cancelling an ask.
----------------------------------------------------------------
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]