-
Notifications
You must be signed in to change notification settings - Fork 264
Change return value of NodeOrderFn from int to float #708
Comments
hi @lmzqwer2 , where does it lose precision in the function |
I think he means the case |
Yes, it is the case. The int type would treat |
Sorry, I could not get the point. Every score that calculated at each step in |
In nodeorder function named leastReq, the priority calculated as
the result of this priority should be naturally float ((4Gi - 1.5Gi) * 10 / 4Gi = 6.25 ) but now is int64 ( = 6) because of the integer division. The precision is lost in the first place. In this case, it is imprecise. So, I provide a way to keep the priority value precise, and all the lost of precision would be just the behavior of strategy itself (like the leastReq using integer division). |
@lmzqwer2 Yes, But score returned by leastRequestedFn is int. So it does make any change in precision if we change return type from int to float, because it is not going to make any difference. |
we're going to add new nodeOrderFn later which dependent on this RP. |
The old functions like leastRequestedFn should modify carefully, so I keep all of its behavior unchanged now. But new function could benefit from it immediately. |
Is this a BUG REPORT or FEATURE REQUEST?:
/kind feature
What happened:
definition of NodeOrderFn is
but the int type would lost precision when two node is similar.
What you expected to happen:
we can distinguish two node with similar priority
How to reproduce it (as minimally and precisely as possible):
I wanna to change the type of return value from int to float
Anything else we need to know?:
Environment:
kubectl version
): N/Auname -a
):N/AThe text was updated successfully, but these errors were encountered: