-
Notifications
You must be signed in to change notification settings - Fork 264
Conversation
@@ -255,23 +255,23 @@ func (pp *nodeOrderPlugin) OnSessionOpen(ssn *framework.Session) { | |||
return 0, err | |||
} | |||
// If leastReqWeight in provided, host.Score is multiplied with weight, if not, host.Score is added to total score. | |||
score = score + (host.Score * weight.leastReqWeight) | |||
score = score + float64(host.Score*weight.leastReqWeight) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets int
at each step, where does it get float
value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a function with float value now.
But I think the calculation of leastReq should return float and others may meet the same situation. So I just provide a way to choose the best fist node but not a set of similar node with the same score.
@@ -75,13 +75,13 @@ func PrioritizeNodes(task *api.TaskInfo, nodes []*api.NodeInfo, fn api.NodeOrder | |||
} | |||
|
|||
// SelectBestNode returns nodes by order of score | |||
func SelectBestNode(nodeScores map[int][]*api.NodeInfo) []*api.NodeInfo { | |||
func SelectBestNode(nodeScores map[float64][]*api.NodeInfo) []*api.NodeInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I'll send PR after this.
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: k82cn, lmzqwer2 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
NodeOrderFn return float value
NodeOrderFn return float value
NodeOrderFn return float value
What this PR does / why we need it:
As I said in issue #708, changing the return value of NodeOrderFn from float to int would be better.
The ability of NodeOrderFn remains unchanged now, because functions like leastReq still returns int type and int type could change to float type safely.
But the code after this would benefit from it.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #708
Special notes for your reviewer:
Release note: