wilfred-s commented on a change in pull request #251:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/251#discussion_r583266333
##########
File path: pkg/scheduler/partition.go
##########
@@ -1185,18 +1180,29 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
// NOTE: this is a lock free call. It must NOT be called holding the
PartitionContext lock.
func (pc *PartitionContext) removeAllocationAsk(appID string, allocationKey
string) {
app := pc.getApplication(appID)
- if app != nil {
- // remove the allocation asks from the app
- reservedAsks := app.RemoveAllocationAsk(allocationKey)
- log.Logger().Info("release allocation ask",
+ if app == nil {
+ log.Logger().Info("Invalid ask release requested by shim",
zap.String("allocation", allocationKey),
- zap.String("appID", appID),
- zap.Int("reservedAskReleased", reservedAsks))
- // update the partition if the asks were reserved (clean up)
- if reservedAsks != 0 {
- pc.unReserveCount(appID, reservedAsks)
- }
+ zap.String("appID", appID))
+ return
+ }
+ // remove the allocation asks from the app
+ reservedAsks := app.RemoveAllocationAsk(allocationKey)
+ // update the partition if the asks were reserved (clean up)
+ if reservedAsks != 0 {
+ pc.unReserveCount(appID, reservedAsks)
+ }
+}
+
+// Remove the allocation Ask from the specified application
+// NOTE: this is a lock free call. It must NOT be called holding the
PartitionContext lock.
+func (pc *PartitionContext) addAllocationAsk(siAsk *si.AllocationAsk) error {
+ app := pc.getApplication(siAsk.ApplicationID)
+ if app == nil {
+ return fmt.Errorf("failed to find application %s, for
allocation ask %s", siAsk.ApplicationID, siAsk.AllocationKey)
}
+ // remove the allocation asks from the app
Review comment:
done
##########
File path: pkg/scheduler/partition.go
##########
@@ -1185,18 +1180,29 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
// NOTE: this is a lock free call. It must NOT be called holding the
PartitionContext lock.
func (pc *PartitionContext) removeAllocationAsk(appID string, allocationKey
string) {
app := pc.getApplication(appID)
- if app != nil {
- // remove the allocation asks from the app
- reservedAsks := app.RemoveAllocationAsk(allocationKey)
- log.Logger().Info("release allocation ask",
+ if app == nil {
+ log.Logger().Info("Invalid ask release requested by shim",
zap.String("allocation", allocationKey),
- zap.String("appID", appID),
- zap.Int("reservedAskReleased", reservedAsks))
- // update the partition if the asks were reserved (clean up)
- if reservedAsks != 0 {
- pc.unReserveCount(appID, reservedAsks)
- }
+ zap.String("appID", appID))
+ return
+ }
+ // remove the allocation asks from the app
+ reservedAsks := app.RemoveAllocationAsk(allocationKey)
+ // update the partition if the asks were reserved (clean up)
+ if reservedAsks != 0 {
+ pc.unReserveCount(appID, reservedAsks)
+ }
+}
+
+// Remove the allocation Ask from the specified application
Review comment:
done
----------------------------------------------------------------
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]