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

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


The following commit(s) were added to refs/heads/branch-1.5 by this push:
     new d0d21d21 [YUNIKORN-2545] Eliminate multiple lock calls from Queue 
(#836)
d0d21d21 is described below

commit d0d21d218255f5869cf14249c0db70ae295c118b
Author: Peter Bacsko <pbac...@cloudera.com>
AuthorDate: Wed Apr 10 20:43:03 2024 +0200

    [YUNIKORN-2545] Eliminate multiple lock calls from Queue (#836)
    
    Do not obtain a second RLock() if we already have a lock instance.
    
    Closes: #836
    
    Signed-off-by: Peter Bacsko <pbac...@cloudera.com>
---
 pkg/scheduler/objects/queue.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index 5611d2a8..d481d65c 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -131,15 +131,17 @@ func NewConfiguredQueue(conf configs.QueueConfig, parent 
*Queue) (*Queue, error)
        // add to the parent, we might have an overall lock already
        // still need to make sure we lock the parent so we do not interfere 
with scheduling
        if parent != nil {
+               // pull the properties from the parent that should be set on 
the child
+               sq.mergeProperties(parent.getProperties(), conf.Properties)
+               sq.UpdateQueueProperties()
                sq.QueuePath = parent.QueuePath + configs.DOT + sq.Name
                err := parent.addChildQueue(sq)
                if err != nil {
                        return nil, fmt.Errorf("configured queue creation 
failed: %w", err)
                }
-               // pull the properties from the parent that should be set on 
the child
-               sq.mergeProperties(parent.getProperties(), conf.Properties)
+       } else {
+               sq.UpdateQueueProperties()
        }
-       sq.UpdateQueueProperties()
        sq.queueEvents = newQueueEvents(sq, events.GetEventSystem())
        log.Log(log.SchedQueue).Info("configured queue added to scheduler",
                zap.String("queueName", sq.QueuePath))
@@ -635,6 +637,7 @@ func (sq *Queue) GetPartitionQueueDAOInfo(exclude bool) 
dao.PartitionQueueDAOInf
                }
        }
        // we have held the read lock so following method should not take lock 
again.
+       queueInfo.HeadRoom = sq.getHeadRoom().DAOMap()
        sq.RLock()
        defer sq.RUnlock()
 
@@ -648,7 +651,6 @@ func (sq *Queue) GetPartitionQueueDAOInfo(exclude bool) 
dao.PartitionQueueDAOInf
        queueInfo.GuaranteedResource = sq.guaranteedResource.DAOMap()
        queueInfo.AllocatedResource = sq.allocatedResource.DAOMap()
        queueInfo.PreemptingResource = sq.preemptingResource.DAOMap()
-       queueInfo.HeadRoom = sq.getHeadRoom().DAOMap()
        queueInfo.IsLeaf = sq.isLeaf
        queueInfo.IsManaged = sq.isManaged
        queueInfo.CurrentPriority = sq.getCurrentPriority()
@@ -726,7 +728,6 @@ func (sq *Queue) AddApplication(app *Application) {
        defer sq.Unlock()
        appID := app.ApplicationID
        sq.applications[appID] = app
-       sq.appPriorities[appID] = app.GetAskMaxPriority()
        sq.queueEvents.sendNewApplicationEvent(appID)
        // YUNIKORN-199: update the quota from the namespace
        // get the tag with the quota
@@ -918,7 +919,7 @@ func (sq *Queue) addChildQueue(child *Queue) error {
 
        // no need to lock child as it is a new queue which cannot be accessed 
yet
        sq.children[child.Name] = child
-       sq.childPriorities[child.Name] = child.GetCurrentPriority()
+       sq.childPriorities[child.Name] = child.getCurrentPriority()
 
        if child.isLeaf {
                // managed (configured) leaf queue can't use template


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: issues-h...@yunikorn.apache.org

Reply via email to