Skip to content

Commit

Permalink
Merge pull request #1042 from zen-xu/queue-capability
Browse files Browse the repository at this point in the history
Fix Queue capability overuse when specify minAvailable  less than task replicas
  • Loading branch information
volcano-sh-bot authored Sep 16, 2020
2 parents 94ee2e8 + f8bb04c commit 200431f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/scheduler/plugins/proportion/proportion.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ type queueAttr struct {
allocated *api.Resource
request *api.Resource
// inqueue represents the resource request of the inqueue job
inqueue *api.Resource
inqueue *api.Resource
capability *api.Resource
}

// GetJobMinResources return the min resources of podgroup.
Expand Down Expand Up @@ -94,6 +95,10 @@ func (pp *proportionPlugin) OnSessionOpen(ssn *framework.Session) {
request: api.EmptyResource(),
inqueue: api.EmptyResource(),
}
if len(queue.Queue.Spec.Capability) != 0 {
attr.capability = api.NewResource(queue.Queue.Spec.Capability)
}

pp.queueOpts[job.Queue] = attr
klog.V(4).Infof("Added Queue <%s> attributes.", job.Queue)
}
Expand Down Expand Up @@ -161,11 +166,15 @@ func (pp *proportionPlugin) OnSessionOpen(ssn *framework.Session) {
oldDeserved := attr.deserved.Clone()
attr.deserved.Add(remaining.Clone().Multi(float64(attr.weight) / float64(totalWeight)))

if attr.request.Less(attr.deserved) {
if attr.capability != nil && !attr.deserved.LessEqualStrict(attr.capability) {
attr.deserved = helpers.Min(attr.deserved, attr.capability)
attr.deserved = helpers.Min(attr.deserved, attr.request)
meet[attr.queueID] = struct{}{}
klog.V(4).Infof("queue <%s> is meet cause of the capability", attr.name)
} else if attr.request.Less(attr.deserved) {
attr.deserved = helpers.Min(attr.deserved, attr.request)
meet[attr.queueID] = struct{}{}
klog.V(4).Infof("queue <%s> is meet", attr.name)

}
pp.updateShare(attr)

Expand Down

0 comments on commit 200431f

Please sign in to comment.