You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2021/04/08 13:27:25 UTC

[GitHub] [incubator-yunikorn-core] wilfred-s commented on a change in pull request #264: [YUNIKORN-631] undefined max resource handling

wilfred-s commented on a change in pull request #264:
URL: https://github.com/apache/incubator-yunikorn-core/pull/264#discussion_r609698518



##########
File path: pkg/common/resources/resources.go
##########
@@ -395,12 +395,26 @@ func subNonNegative(left, right *Resource) (*Resource, string) {
 	}
 	return out, message
 }
-
-// Check if smaller fitin larger, negative values will be treated as 0
-// A nil resource is treated as an empty resource (zero)
+// Check if smaller fits in larger, negative values will be treated as 0
+// Types not defined in the larger resource are considered 0 values for Quantity
+// A nil resource is treated as an empty resource (all types are 0)
 func FitIn(larger, smaller *Resource) bool {

Review comment:
       I thought about that but could not really think of a good name, that is why I left it.
   
   The difference is in the description of the function: type is not defined becomes 0, type is not defined becomes max Quantity (i.e. max int64) 
   Since Quantity can never be larger and thus will always fit, the value check is skipped:
   ```
    if skipUndef && !ok {
     continue
   }
   ```
   implements the difference between the two.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org