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


##########
pkg/common/configs/configvalidator.go:
##########
@@ -232,54 +232,53 @@ func checkLimitMaxApplications(cur QueueConfig, users 
map[string]map[string]uint
                curQueuePath = queuePath + DOT + cur.Name
        }
 
-       // Carry forward (populate) the parent limit settings to the next level 
if limits are not configured for the current queue
-       if len(cur.Limits) == 0 {
-               if _, ok := users[queuePath]; ok {
-                       users[curQueuePath] = users[queuePath]
-               }
-               if _, ok := groups[queuePath]; ok {
-                       groups[curQueuePath] = groups[queuePath]
-               }
-       } else {
-               // compare user & group limit setting between the current queue 
and parent queue
-               for _, limit := range cur.Limits {
-                       limitMaxApplications := limit.MaxApplications
-                       for _, user := range limit.Users {
-                               // Is user limit setting exists?
-                               if userMaxApplications, ok := 
users[queuePath][user]; ok {
-                                       if userMaxApplications != 0 && 
(userMaxApplications < limitMaxApplications || limitMaxApplications == 0) {
-                                               return fmt.Errorf("user %s max 
applications %d of queue %s is greater than immediate or ancestor parent max 
applications %d", user, limitMaxApplications, cur.Name, userMaxApplications)
-                                       }
-                                       // Override with min resource
-                                       if _, ok := users[curQueuePath]; !ok {
-                                               users[curQueuePath] = 
make(map[string]uint64)
-                                       }
-                                       users[curQueuePath][user] = 
common.Min(limitMaxApplications, userMaxApplications)
-                               } else {
-                                       if _, ok := users[curQueuePath]; !ok {
-                                               users[curQueuePath] = 
make(map[string]uint64)
-                                       }
-                                       users[curQueuePath][user] = 
limitMaxApplications
+       users[curQueuePath] = make(map[string]uint64)
+       groups[curQueuePath] = make(map[string]uint64)
+
+       // Carry forward (populate) the parent limit settings to the next level
+       for u, v := range users[queuePath] {
+               users[curQueuePath][u] = v
+       }

Review Comment:
   Nit: a short comment about the possible values of "curQueuePath" and 
"queuePath" to help understand the code (eg "root.parent" vs 
"root.parent.subparent").



##########
pkg/common/configs/configvalidator.go:
##########
@@ -232,54 +232,53 @@ func checkLimitMaxApplications(cur QueueConfig, users 
map[string]map[string]uint
                curQueuePath = queuePath + DOT + cur.Name
        }
 
-       // Carry forward (populate) the parent limit settings to the next level 
if limits are not configured for the current queue
-       if len(cur.Limits) == 0 {
-               if _, ok := users[queuePath]; ok {
-                       users[curQueuePath] = users[queuePath]
-               }
-               if _, ok := groups[queuePath]; ok {
-                       groups[curQueuePath] = groups[queuePath]
-               }
-       } else {
-               // compare user & group limit setting between the current queue 
and parent queue
-               for _, limit := range cur.Limits {
-                       limitMaxApplications := limit.MaxApplications
-                       for _, user := range limit.Users {
-                               // Is user limit setting exists?
-                               if userMaxApplications, ok := 
users[queuePath][user]; ok {
-                                       if userMaxApplications != 0 && 
(userMaxApplications < limitMaxApplications || limitMaxApplications == 0) {
-                                               return fmt.Errorf("user %s max 
applications %d of queue %s is greater than immediate or ancestor parent max 
applications %d", user, limitMaxApplications, cur.Name, userMaxApplications)
-                                       }
-                                       // Override with min resource
-                                       if _, ok := users[curQueuePath]; !ok {
-                                               users[curQueuePath] = 
make(map[string]uint64)
-                                       }
-                                       users[curQueuePath][user] = 
common.Min(limitMaxApplications, userMaxApplications)
-                               } else {
-                                       if _, ok := users[curQueuePath]; !ok {
-                                               users[curQueuePath] = 
make(map[string]uint64)
-                                       }
-                                       users[curQueuePath][user] = 
limitMaxApplications
+       users[curQueuePath] = make(map[string]uint64)
+       groups[curQueuePath] = make(map[string]uint64)
+
+       // Carry forward (populate) the parent limit settings to the next level
+       for u, v := range users[queuePath] {
+               users[curQueuePath][u] = v
+       }
+       for g, v := range groups[queuePath] {
+               groups[curQueuePath][g] = v
+       }

Review Comment:
   Nit: without having a context, it's difficult to interpret these letters. 
Ok, I guess "u" = user, "g" = group, but what is "v"?



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