psantacl commented on code in PR #935:
URL: https://github.com/apache/yunikorn-core/pull/935#discussion_r1710018909
##########
pkg/common/resources/resources.go:
##########
@@ -455,6 +455,74 @@ func (r *Resource) fitIn(smaller *Resource, skipUndef
bool) bool {
return true
}
+// Denominator Resources can be either guaranteed Resources or fairmax
Resources.
+// If the quanity is explicitly 0 or negative, we will check usage. If usage
>= 0, the share will be set to 1.0. Otherwise, it will be set 0.0.
+func getShareFairForDenominator(resourceType string, allocated Quantity,
denominatorResources *Resource) (float64, bool) {
+ if denominatorResources == nil {
+ return 0.0, false
+ }
+
+ denominator, ok := denominatorResources.Resources[resourceType]
+
+ switch {
+ case ok && denominator <= 0:
+ if denominator < 0 {
Review Comment:
done
##########
pkg/common/resources/resources.go:
##########
@@ -455,6 +455,74 @@ func (r *Resource) fitIn(smaller *Resource, skipUndef
bool) bool {
return true
}
+// Denominator Resources can be either guaranteed Resources or fairmax
Resources.
+// If the quanity is explicitly 0 or negative, we will check usage. If usage
>= 0, the share will be set to 1.0. Otherwise, it will be set 0.0.
+func getShareFairForDenominator(resourceType string, allocated Quantity,
denominatorResources *Resource) (float64, bool) {
+ if denominatorResources == nil {
+ return 0.0, false
+ }
+
+ denominator, ok := denominatorResources.Resources[resourceType]
+
+ switch {
+ case ok && denominator <= 0:
+ if denominator < 0 {
+ log.Log(log.Resources).Debug("denominator is negative.
will not compute share",
+ zap.String("resource key", resourceType),
+ zap.Int64("resource quantity",
int64(denominator)))
+ }
+
+ if allocated <= 0 {
+ //explicit 0 or negative value with NO usage
+ return float64(0.0), true
Review Comment:
done
##########
pkg/common/resources/resources.go:
##########
@@ -455,6 +455,74 @@ func (r *Resource) fitIn(smaller *Resource, skipUndef
bool) bool {
return true
}
+// Denominator Resources can be either guaranteed Resources or fairmax
Resources.
+// If the quanity is explicitly 0 or negative, we will check usage. If usage
>= 0, the share will be set to 1.0. Otherwise, it will be set 0.0.
+func getShareFairForDenominator(resourceType string, allocated Quantity,
denominatorResources *Resource) (float64, bool) {
+ if denominatorResources == nil {
+ return 0.0, false
+ }
+
+ denominator, ok := denominatorResources.Resources[resourceType]
+
+ switch {
+ case ok && denominator <= 0:
+ if denominator < 0 {
+ log.Log(log.Resources).Debug("denominator is negative.
will not compute share",
+ zap.String("resource key", resourceType),
+ zap.Int64("resource quantity",
int64(denominator)))
+ }
+
+ if allocated <= 0 {
+ //explicit 0 or negative value with NO usage
+ return float64(0.0), true
+
+ } else {
+ //explicit 0 or negative value with usage
+ return float64(1.0), true
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]