Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

NodeOrderFn return float value #719

Merged
merged 1 commit into from
Apr 8, 2019

Conversation

lmzqwer2
Copy link
Contributor

@lmzqwer2 lmzqwer2 commented Apr 8, 2019

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:

  1. Just change the return value

Release note:


@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 8, 2019
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 8, 2019
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 8, 2019
@@ -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)
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... it's better to work with #699 :)

/cc @hex108

Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot requested a review from hex108 April 8, 2019 02:03
@hex108
Copy link
Contributor

hex108 commented Apr 8, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2019
@k82cn
Copy link
Contributor

k82cn commented Apr 8, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 8, 2019
@k8s-ci-robot k8s-ci-robot merged commit 957c7c1 into kubernetes-retired:master Apr 8, 2019
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
kevin-wangzefeng pushed a commit to kevin-wangzefeng/scheduler that referenced this pull request Jun 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change return value of NodeOrderFn from int to float
4 participants