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 precision of cpu to millicore and memory to Mi #8409

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

derekwaynecarr
Copy link
Member

Fixes #8391

Fixes code to round down cpu to nearest millicore with a floor of 1m.
Fixes code to round down memory to nearest Mi with a floor of 1Mi.

@spadgett @jwforres @sspeiche @sosiouxme - PTAL

@derekwaynecarr
Copy link
Member Author

I think this should be p1 fix, but I cannot label.

@derekwaynecarr
Copy link
Member Author

[test]

@derekwaynecarr
Copy link
Member Author

Rationale for p1 fix is I will most likely fix the upstream code to fail validation if it gets fractional bytes for memory or sub-millicore precision on CPU

@derekwaynecarr
Copy link
Member Author

@abhgupta - fyi

@sosiouxme
Copy link
Member

LGTM.

Note for the UI team this rounds memory to bytes; output will presumably still show full byte precision if it doesn't fall on binary values (1023 bytes won't round to 1Ki).

@jwforres
Copy link
Member

jwforres commented Apr 8, 2016

we discussed this with @danmcp and this is going to be updated to round to
nearest whole MiB for memory

On Fri, Apr 8, 2016 at 12:31 PM, Luke Meyer [email protected]
wrote:

LGTM.

Note for the UI team this rounds memory to bytes; output will presumably
still show full byte precision if it doesn't fall on binary values (1023
bytes won't round to 1Ki).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8409 (comment)

@derekwaynecarr derekwaynecarr changed the title Fix precision of cpu to millicore and memory to bytes Fix precision of cpu to millicore and memory to Mi Apr 12, 2016
@derekwaynecarr
Copy link
Member Author

@jwforres @danmcp @sosiouxme PTAL

Fixes code to round down cpu to nearest millicore with a floor of 1m.
Fixes code to round down memory to nearest Mi with a floor of 1Mi.

@derekwaynecarr
Copy link
Member Author

@ncdc - this is a blocker bug fix, can you please review?

Amount: multiply(inf.NewDec(int64(float64(memLimit.Value())*cpuBaseScaleFactor), 3), a.config.limitCPUToMemoryRatio),
Format: resource.DecimalSI,
// float math is necessary here as there is no way to create an inf.Dec to represent cpuBaseScaleFactor < 0.001
// cpu is measured in millicores, so we need to scale and round up the value to nearest millicore scale
Copy link
Contributor

Choose a reason for hiding this comment

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

comment says "round up" but you use RoundDown below?

Copy link
Member Author

Choose a reason for hiding this comment

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

will fix comment, round down is correct, comment was missed in my update.

@derekwaynecarr
Copy link
Member Author

Comments updated.

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to a90ca8f

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/2994/)

@ncdc
Copy link
Contributor

ncdc commented Apr 15, 2016

Math is fun 😄

LGTM

@derekwaynecarr
Copy link
Member Author

@smarterclayton - can I have approval and merge?

@eparis
Copy link
Member

eparis commented Apr 19, 2016

I approve and [merge]!

@eparis
Copy link
Member

eparis commented Apr 19, 2016

blast you AWS! [merge] already

@eparis
Copy link
Member

eparis commented Apr 19, 2016

I am relentlessly [merge]ing!

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to a90ca8f

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/2994/) (Image: devenv-rhel7_3997)

@openshift-bot openshift-bot merged commit 7ac4cfa into openshift:master Apr 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants