0yukali0 commented on code in PR #516:
URL: https://github.com/apache/yunikorn-core/pull/516#discussion_r1133179987
##########
pkg/common/configs/configvalidator.go:
##########
@@ -169,9 +185,65 @@ func checkPlacementRules(partition *PartitionConfig) error
{
return err
}
}
+
+ placementStaticPaths :=
getLongestPlacementPaths(partition.PlacementRules)
+ for _, staticPath := range placementStaticPaths {
+ queuePath := staticPath.path
+ parts := strings.Split(strings.ToLower(queuePath), DOT)
+ result := checkQueueHierarchyForPlacement(parts,
staticPath.create, partition.Queues)
+ if result == queueNotParent {
+ return fmt.Errorf("placement rule no. #%d (%s)
references a queue (%s) which is a leaf",
+ staticPath.ruleNo, staticPath.ruleChain,
queuePath)
+ }
+ if result == nonExistingQueue {
+ return fmt.Errorf("placement rule no. #%d (%s)
references non-existing queues (%s) and create is 'false'",
+ staticPath.ruleNo, staticPath.ruleChain,
queuePath)
+ }
+ }
+
return nil
}
+func checkQueueHierarchyForPlacement(path []string, create bool, conf
[]QueueConfig) placementPathCheckResult {
+ queueName := path[0]
+
+ // no more queues in the configuration
+ if len(conf) == 0 {
+ if !create {
+ return nonExistingQueue
+ }
+ return checkOK
+ }
+
+ var queueConf *QueueConfig
+ for _, queue := range conf {
+ queue := queue
Review Comment:
Duplicate assignment.
variable "queue" already get the queue from the QueueConfig in each loop.
--
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]