chia7712 commented on code in PR #763:
URL: https://github.com/apache/yunikorn-core/pull/763#discussion_r1443017028


##########
pkg/common/configs/configvalidator.go:
##########
@@ -595,6 +596,26 @@ func checkLimits(limits []Limit, obj string, queue 
*QueueConfig) error {
        return nil
 }
 
+func checkLimitsStructure(partitionConfig *PartitionConfig) error {
+       partitionLimits := partitionConfig.Limits
+       rootQueue := partitionConfig.Queues[0]
+
+       if len(partitionConfig.Queues) < 1 || 
strings.ToLower(partitionConfig.Queues[0].Name) != RootQueue {
+               return fmt.Errorf("top queue is not root")
+       }
+
+       if len(partitionLimits) > 0 && len(rootQueue.Limits) > 0 && 
!reflect.DeepEqual(partitionLimits, rootQueue.Limits) {
+               return fmt.Errorf("partition limits and root queue limits are 
not equivalent")
+       }
+
+       // if root queue limits not defined, apply partition limits
+       if len(partitionLimits) > 0 && len(rootQueue.Limits) == 0 {
+               partitionConfig.Queues[0].Limits = partitionLimits

Review Comment:
   ditto



##########
pkg/common/configs/configvalidator.go:
##########
@@ -595,6 +596,26 @@ func checkLimits(limits []Limit, obj string, queue 
*QueueConfig) error {
        return nil
 }
 
+func checkLimitsStructure(partitionConfig *PartitionConfig) error {
+       partitionLimits := partitionConfig.Limits
+       rootQueue := partitionConfig.Queues[0]
+
+       if len(partitionConfig.Queues) < 1 || 
strings.ToLower(partitionConfig.Queues[0].Name) != RootQueue {
+               return fmt.Errorf("top queue is not root")

Review Comment:
   the error message can include the name of current top queue.



##########
pkg/common/configs/configvalidator.go:
##########
@@ -595,6 +596,26 @@ func checkLimits(limits []Limit, obj string, queue 
*QueueConfig) error {
        return nil
 }
 
+func checkLimitsStructure(partitionConfig *PartitionConfig) error {
+       partitionLimits := partitionConfig.Limits
+       rootQueue := partitionConfig.Queues[0]
+
+       if len(partitionConfig.Queues) < 1 || 
strings.ToLower(partitionConfig.Queues[0].Name) != RootQueue {

Review Comment:
   `partitionConfig.Queues[0]` can be replaced by `rootQueue`



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