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

mani 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 462381d4 [YUNIKORN-3193] Handle delay consecutive increase and 
decrease in any order (#1063)
462381d4 is described below

commit 462381d49b6545147cf5fa64a9952340821a2db7
Author: mani <[email protected]>
AuthorDate: Tue Jan 27 21:38:52 2026 +0530

    [YUNIKORN-3193] Handle delay consecutive increase and decrease in any order 
(#1063)
    
    Closes: #1063
    
    Signed-off-by: mani <[email protected]>
---
 pkg/scheduler/objects/queue.go      | 21 +++++++++++++++++++++
 pkg/scheduler/objects/queue_test.go |  5 ++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index 18342434..73a19060 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -463,6 +463,27 @@ func (sq *Queue) setPreemptionTime(oldMaxResource 
*resources.Resource, oldDelay
                        zap.Stringer("maxResources", sq.maxResource),
                        zap.Duration("delay", sq.quotaPreemptionDelay),
                        zap.Time("quotaPreemptionStartTime", 
sq.quotaPreemptionStartTime))
+               return
+       }
+
+       // Quota has been increased but earlier set quota changes not yet 
enforced.
+       // Irrespective of whether quota increased from already lowered value 
or the original value (which is not yet enforced either ways),
+       // decision would be taken later based on the usage then during the 
scheduling cycle
+       // Adjust the delay only here if it has been changed
+       if resources.StrictlyGreaterThan(sq.maxResource, oldMaxResource) {
+               if !sq.quotaPreemptionStartTime.IsZero() {
+                       if oldDelay != sq.quotaPreemptionDelay {
+                               sq.quotaPreemptionStartTime = 
sq.quotaPreemptionStartTime.Add(sq.quotaPreemptionDelay - oldDelay)
+                               log.Log(log.SchedQueue).Info("consecutive 
change of quota with delay change",
+                                       zap.String("queue", sq.QueuePath),
+                                       zap.Time("quotaPreemptionStartTime", 
sq.quotaPreemptionStartTime),
+                                       zap.Duration("delta", 
sq.quotaPreemptionDelay-oldDelay))
+                               return
+                       }
+                       log.Log(log.SchedQueue).Info("consecutive change of 
quota: preemption time already set from earlier quota change",
+                               zap.String("queue", sq.QueuePath),
+                               zap.Time("quotaPreemptionStartTime", 
sq.quotaPreemptionStartTime))
+               }
        }
 }
 
diff --git a/pkg/scheduler/objects/queue_test.go 
b/pkg/scheduler/objects/queue_test.go
index 399e8581..c494f2b5 100644
--- a/pkg/scheduler/objects/queue_test.go
+++ b/pkg/scheduler/objects/queue_test.go
@@ -3205,10 +3205,13 @@ func TestQueue_setPreemptionTime(t *testing.T) {
                {"delay added", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "100"}, 0, 10, false, true},
                {"delay change set start", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "100"}, 5, 10, true, true},
                {"delay change no start", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "100"}, 5, 10, false, false},
-               {"max increase", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 10}), 
map[string]string{"test": "100"}, 10, 10, false, false},
                {"max lowered", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 10, 10, false, true},
                {"max lowered 2nd", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 10, 10, true, false},
                {"delay change max lowered 2nd", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 5, 10, true, true},
+               {"max increase", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 10}), 
map[string]string{"test": "100"}, 5, 5, true, false},
+               {"max increased 2nd with delay change", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "120"}, 5, 10, true, true}, {"max increased 2nd with 
delay change", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "120"}, 5, 10, true, true},
+               {"max lowered again", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 10, 10, true, false},
+               {"max lowered again 2nd", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 10, 5, true, true},
        }
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {


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

Reply via email to