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

pbacsko 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 37d7e5c5 [YUNIKORN-2642] Don't set resources on the recovery queue 
(#878)
37d7e5c5 is described below

commit 37d7e5c5431c3aec9686b8bfb787cdccf0834549
Author: Peter Bacsko <[email protected]>
AuthorDate: Thu May 30 09:47:13 2024 +0200

    [YUNIKORN-2642] Don't set resources on the recovery queue (#878)
    
    Closes: #878
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/scheduler/partition.go      |  5 +++--
 pkg/scheduler/partition_test.go | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go
index 11ee05ae..5662bd75 100644
--- a/pkg/scheduler/partition.go
+++ b/pkg/scheduler/partition.go
@@ -320,8 +320,9 @@ func (pc *PartitionContext) AddApplication(app 
*objects.Application) error {
        queue := pc.getQueueInternal(queueName)
 
        // create the queue if necessary
+       isRecoveryQueue := common.IsRecoveryQueue(queueName)
        if queue == nil {
-               if common.IsRecoveryQueue(queueName) {
+               if isRecoveryQueue {
                        queue, err = pc.createRecoveryQueue()
                        if err != nil {
                                return fmt.Errorf("failed to create recovery 
queue %s for application %s", common.RecoveryQueueFull, appID)
@@ -341,7 +342,7 @@ func (pc *PartitionContext) AddApplication(app 
*objects.Application) error {
 
        guaranteedRes := app.GetGuaranteedResource()
        maxRes := app.GetMaxResource()
-       if guaranteedRes != nil || maxRes != nil {
+       if !isRecoveryQueue && (guaranteedRes != nil || maxRes != nil) {
                // set resources based on tags, but only if the queue is 
dynamic (unmanaged)
                if queue.IsManaged() {
                        log.Log(log.SchedQueue).Warn("Trying to set resources 
on a queue that is not an unmanaged leaf",
diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go
index eabb1ad4..e99d5761 100644
--- a/pkg/scheduler/partition_test.go
+++ b/pkg/scheduler/partition_test.go
@@ -964,6 +964,22 @@ func TestAddAppForced(t *testing.T) {
        assert.Equal(t, common.RecoveryQueueFull, partApp3.GetQueuePath(), 
"wrong queue path for app3")
        assert.Check(t, recoveryQueue == partApp3.GetQueue(), "wrong queue for 
app3")
        assert.Equal(t, 3, len(recoveryQueue.GetCopyOfApps()), "wrong queue 
length")
+
+       // add recovered forced apps with resource tags
+       app4 := newApplicationTags("app-4", "default", 
common.RecoveryQueueFull, map[string]string{
+               siCommon.AppTagCreateForce:                 "true",
+               siCommon.AppTagNamespaceResourceGuaranteed: 
"{\"resources\":{\"vcore\":{\"value\":111}}}"})
+       err = partition.AddApplication(app4)
+       assert.NilError(t, err, "app4 could not be added")
+       assert.Assert(t, recoveryQueue.GetGuaranteedResource() == nil, 
"guaranteed resource should be unset")
+       assert.Assert(t, recoveryQueue.GetMaxResource() == nil, "max resource 
should be unset")
+       app5 := newApplicationTags("app-5", "default", 
common.RecoveryQueueFull, map[string]string{
+               siCommon.AppTagCreateForce:            "true",
+               siCommon.AppTagNamespaceResourceQuota: 
"{\"resources\":{\"vcore\":{\"value\":111}}}"})
+       err = partition.AddApplication(app5)
+       assert.NilError(t, err, "app5 could not be added")
+       assert.Assert(t, recoveryQueue.GetGuaranteedResource() == nil, 
"guaranteed resource should be unset")
+       assert.Assert(t, recoveryQueue.GetMaxResource() == nil, "max resource 
should be unset")
 }
 
 func TestAddAppForcedWithPlacement(t *testing.T) {


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

Reply via email to