pbacsko commented on code in PR #538:
URL: https://github.com/apache/yunikorn-core/pull/538#discussion_r1219873679


##########
pkg/common/configs/configvalidator.go:
##########
@@ -139,6 +139,72 @@ func checkQueueResource(cur QueueConfig, parentM 
*resources.Resource) (*resource
        return curG, nil
 }
 
+func checkLimitResource(cur QueueConfig, parent *QueueConfig, users 
map[string]*resources.Resource, groups map[string]*resources.Resource) error {
+       // Collect user and group limits of parent queue
+       if parent != nil {
+               for _, limit := range parent.Limits {
+                       for _, user := range limit.Users {
+                               var err error
+                               users[user], err = 
resources.NewResourceFromConf(limit.MaxResources)
+                               if err != nil {
+                                       return err
+                               }
+                       }
+                       for _, group := range limit.Groups {
+                               var err error
+                               groups[group], err = 
resources.NewResourceFromConf(limit.MaxResources)
+                               if err != nil {
+                                       return err
+                               }
+                       }
+               }
+       }
+
+       // compare user & group limit setting between the current queue and 
parent queue
+       for _, limit := range cur.Limits {
+               for _, user := range limit.Users {
+                       curM, err := 
resources.NewResourceFromConf(limit.MaxResources)

Review Comment:
   Two things:
   1. Consider a better name for `curM` and `cur`, it's not clear what they 
stand for.
   2. We keep creating `curM` in an embeddef loop, is this necessary? How about 
creating it outside and maybe clone it if needed (`users[user] = curM.Clone())` 
?



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

Reply via email to