Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix convertQuanToPercent func #2325

Merged

Conversation

autumn0207
Copy link
Contributor

@autumn0207 autumn0207 commented Jul 2, 2022

the result of func convertQuanToPercent needs to be multiplied by 100

Signed-off-by: Tian Qiu 329508111@qq.com

@volcano-sh-bot volcano-sh-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 2, 2022
@autumn0207
Copy link
Contributor Author

Can you provide more details about the datas amount and percent you tested locally?

@Thor-wl OK.
I have placed a task that requires 1 core on a node with a capacity of 60 cores.

apiVersion: v1
kind: Pod
...
spec:
  containers:
  - command:
    - sleep
    - 10m
    image: nginx:latest
    imagePullPolicy: Always
    name: nginx
    resources:
      limits:
        cpu: "1"
      requests:
        cpu: "1"

Now the task is evicted by rescheduling plugin and I add logs to print the node cpu utilization and the return value of function convertQuanToPercent:

I0702 15:22:54.298356       1 node_utilization_util.go:175] 60.95572916666303 0.015625

Obviously the return value of function convertQuanToPercent for this task should be 1.5625 not 0.015625, otherwise the following codes will be meaningless:

utilization.utilization[v1.ResourceCPU] -= convertQuanToPercent(v1.ResourceCPU, &usedCPU, utilization.nodeInfo.Status.Capacity)

@Thor-wl
Copy link
Contributor

Thor-wl commented Jul 4, 2022

Can you provide more details about the datas amount and percent you tested locally?

@Thor-wl OK. I have placed a task that requires 1 core on a node with a capacity of 60 cores.

apiVersion: v1
kind: Pod
...
spec:
  containers:
  - command:
    - sleep
    - 10m
    image: nginx:latest
    imagePullPolicy: Always
    name: nginx
    resources:
      limits:
        cpu: "1"
      requests:
        cpu: "1"

Now the task is evicted by rescheduling plugin and I add logs to print the node cpu utilization and the return value of function convertQuanToPercent:

I0702 15:22:54.298356       1 node_utilization_util.go:175] 60.95572916666303 0.015625

Obviously the return value of function convertQuanToPercent for this task should be 1.5625 not 0.015625, otherwise the following codes will be meaningless:

utilization.utilization[v1.ResourceCPU] -= convertQuanToPercent(v1.ResourceCPU, &usedCPU, utilization.nodeInfo.Status.Capacity)

Good job! I'm OK about that. Please format the code to pass the code verification and push again.

@Thor-wl Thor-wl requested review from hwdef and shinytang6 and removed request for hudson741 July 4, 2022 07:50
Signed-off-by: Tian Qiu <329508111@qq.com>
@Thor-wl
Copy link
Contributor

Thor-wl commented Jul 4, 2022

@autumn0207 Can you cherry-pick all the bug fixes to branch release 1.6 as well? I'll launch a bug fix release later.
/lgtm
/approve

@volcano-sh-bot volcano-sh-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 4, 2022
@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Thor-wl

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

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 4, 2022
@volcano-sh-bot volcano-sh-bot merged commit 17b9cfb into volcano-sh:master Jul 4, 2022
@autumn0207
Copy link
Contributor Author

@autumn0207 Can you cherry-pick all the bug fixes to branch release 1.6 as well? I'll launch a bug fix release later. /lgtm /approve

@Thor-wl
sure, already done, refer to #2330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants