This is an automated email from the ASF dual-hosted git repository.

brandboat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new d8e8c35d [YUNIKORN-2181] Remove Named Returns in 
checkQueueHierarchyForPlacement (#851)
d8e8c35d is described below

commit d8e8c35da3f0201604d4c066cfd61604bea46ea2
Author: SHIAO SZU CHEN <[email protected]>
AuthorDate: Mon Apr 22 11:31:00 2024 +0800

    [YUNIKORN-2181] Remove Named Returns in checkQueueHierarchyForPlacement 
(#851)
    
    Closes: #851
    
    Signed-off-by: Kuan-Po Tseng <[email protected]>
---
 pkg/common/configs/configvalidator.go | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/pkg/common/configs/configvalidator.go 
b/pkg/common/configs/configvalidator.go
index 6cd2f0b2..26c85233 100644
--- a/pkg/common/configs/configvalidator.go
+++ b/pkg/common/configs/configvalidator.go
@@ -356,24 +356,22 @@ func checkPlacementRules(partition *PartitionConfig) 
error {
        return nil
 }
 
-func checkQueueHierarchyForPlacement(path []string, create, hasDynamicPart 
bool, conf []QueueConfig, parentConf *QueueConfig) (result 
placementPathCheckResult, lastQueueName string) {
+func checkQueueHierarchyForPlacement(path []string, create, hasDynamicPart 
bool, conf []QueueConfig, parentConf *QueueConfig) (placementPathCheckResult, 
string) {
        queueName := path[0]
-       lastQueueName = ""
+       lastQueueName := ""
 
        // no more queues in the configuration
        if len(conf) == 0 {
                if !parentConf.Parent {
                        // path in the hierarchy is shorter, but the last queue 
is a leaf
-                       result = errLastQueueLeaf
                        lastQueueName = parentConf.Name
-                       return
+                       return errLastQueueLeaf, lastQueueName
                }
                if !create {
-                       result = errNonExistingQueue
-                       return
+                       return errNonExistingQueue, lastQueueName
                }
-               result = placementOK
-               return
+
+               return placementOK, lastQueueName
        }
 
        var queueConf *QueueConfig
@@ -388,11 +386,10 @@ func checkQueueHierarchyForPlacement(path []string, 
create, hasDynamicPart bool,
        // queue not found on this level
        if queueConf == nil {
                if !create {
-                       result = errNonExistingQueue
-                       return
+                       return errNonExistingQueue, lastQueueName
                }
-               result = placementOK
-               return
+
+               return placementOK, lastQueueName
        }
 
        if len(path) == 1 {
@@ -400,18 +397,16 @@ func checkQueueHierarchyForPlacement(path []string, 
create, hasDynamicPart bool,
                        // the "fixed" rule is followed by other rules like 
tag, user, etc. (root.dev.<user>),
                        // which means that the "fixed" part must point to a 
parent
                        if queueConf.Parent {
-                               result = placementOK
-                               return
+                               return placementOK, lastQueueName
                        }
-                       result = errQueueNotLeaf
-                       return
+
+                       return errQueueNotLeaf, lastQueueName
                }
                if queueConf.Parent {
-                       result = errQueueNotLeaf
-                       return
+                       return errQueueNotLeaf, lastQueueName
                }
-               result = placementOK
-               return
+
+               return placementOK, lastQueueName
        }
 
        path = path[1:]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to