From a80150ee60b386dd6cb9448a3036275fbe5971d9 Mon Sep 17 00:00:00 2001 From: Ziyang Wu Date: Wed, 27 Mar 2019 16:49:26 +0800 Subject: [PATCH] Fix wrong caculation for deserved in proportion plugin --- pkg/scheduler/plugins/proportion/proportion.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/plugins/proportion/proportion.go b/pkg/scheduler/plugins/proportion/proportion.go index 4a0c5a6c1..2f2db190f 100644 --- a/pkg/scheduler/plugins/proportion/proportion.go +++ b/pkg/scheduler/plugins/proportion/proportion.go @@ -124,6 +124,7 @@ func (pp *proportionPlugin) OnSessionOpen(ssn *framework.Session) { continue } + oldDeserved := attr.deserved.Clone() attr.deserved.Add(remaining.Clone().Multi(float64(attr.weight) / float64(totalWeight))) if !attr.deserved.LessEqual(attr.request) { attr.deserved = helpers.Min(attr.deserved, attr.request) @@ -134,7 +135,7 @@ func (pp *proportionPlugin) OnSessionOpen(ssn *framework.Session) { glog.V(4).Infof("The attributes of queue <%s> in proportion: deserved <%v>, allocate <%v>, request <%v>, share <%0.2f>", attr.name, attr.deserved, attr.allocated, attr.request, attr.share) - deserved.Add(attr.deserved) + deserved.Add(attr.deserved.Clone().Sub(oldDeserved)) } remaining.Sub(deserved)