yangwwei commented on a change in pull request #152:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/152#discussion_r428430629
##########
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:
This is less efficient, and it assumes a proposal only has 1 allocation.
To fix the uuid issue, can we use the approach we used in #151 ? That said,
to define
https://github.com/yangwwei/incubator-yunikorn-core/blob/8f2ffe4cbd54ad2e49bb193a938de0a0bd048009/pkg/scheduler/schedulerevent/events.go#L39.
And use this like:
https://github.com/yangwwei/incubator-yunikorn-core/blob/8f2ffe4cbd54ad2e49bb193a938de0a0bd048009/pkg/scheduler/scheduler.go#L326-L337.
----------------------------------------------------------------
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]