pbacsko commented on a change in pull request #353:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/353#discussion_r787672407



##########
File path: pkg/scheduler/objects/queue.go
##########
@@ -246,9 +259,36 @@ func (sq *Queue) applyConf(conf configs.QueueConfig) error 
{
        }
 
        sq.properties = conf.Properties
+       sq.limits = conf.Limits
        return nil
 }
 
+func (sq *Queue) GetConfigLimits() []configs.Limit {
+       var limit []configs.Limit
+       // get the limit for the parent first
+       if sq.parent != nil {
+               limit = sq.parent.GetConfigLimits()
+       }
+       return sq.internalGetConfigLimits(limit)
+}
+
+func (sq *Queue) internalGetConfigLimits(parentLimit []configs.Limit) 
[]configs.Limit {
+       sq.RLock()
+       defer sq.RUnlock()
+       // no limit set in parent queue, not even for root
+       if parentLimit == nil {
+               if sq.limits == nil {
+                       return nil
+               }
+               return sq.limits
+       }
+       // parent limit set, no queue limit return parent
+       if sq.limits == nil {
+               return parentLimit
+       }
+       return sq.limits

Review comment:
       Couldn't this be simplified?
   
   Eg. 
   ```if sq.limits != nil {
     return. sq.limits
   }
   
   return parentLimit
   ```
   
   So we return the current queues's limit if not nil, otherwise we just pass 
the parentLimit no matter what.




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