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

wilfreds 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 ffb5bf5c [YUNIKORN-2141] Exclude released placeholder in preemption 
(#710)
ffb5bf5c is described below

commit ffb5bf5c568cd556c1b2372c95cde5a1d3b9f51e
Author: qzhu <[email protected]>
AuthorDate: Mon Nov 13 10:50:45 2023 +1100

    [YUNIKORN-2141] Exclude released placeholder in preemption (#710)
    
    If a placeholder is already released for a replacement with the real
    allocation the placeholder should be skipped during preemption.
    Preempting a released placeholder will leave the real allocation stuck
    waiting for the release confirmation.
    
    Closes: #710
    
    Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
 pkg/scheduler/objects/queue.go      | 5 +++++
 pkg/scheduler/objects/queue_test.go | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index 3d2cec67..b371f6c6 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -1752,6 +1752,11 @@ func (sq *Queue) findEligiblePreemptionVictims(results 
map[string]*QueuePreempti
                                        continue
                                }
 
+                               // skip placeholder tasks which are marked 
released
+                               if alloc.IsReleased() {
+                                       continue
+                               }
+
                                // if we have encountered a fence then all 
tasks are eligible for preemption
                                // otherwise the task is a candidate if its 
priority is less than or equal to the ask priority
                                if fenced || int64(alloc.GetPriority()) <= 
askPriority {
diff --git a/pkg/scheduler/objects/queue_test.go 
b/pkg/scheduler/objects/queue_test.go
index 909c86b1..b7bef5d7 100644
--- a/pkg/scheduler/objects/queue_test.go
+++ b/pkg/scheduler/objects/queue_test.go
@@ -1943,6 +1943,13 @@ func TestFindEligiblePreemptionVictims(t *testing.T) {
        assert.Equal(t, alloc3.allocationKey, 
victims(snapshot)[0].allocationKey, "wrong alloc")
        alloc2.GetAsk().SetRequiredNode("")
 
+       // placeholder which has been marked released should not be considered
+       alloc2.released = true
+       snapshot = leaf1.FindEligiblePreemptionVictims(leaf1.QueuePath, ask)
+       assert.Equal(t, 1, len(victims(snapshot)), "wrong victim count")
+       assert.Equal(t, alloc3.allocationKey, 
victims(snapshot)[0].allocationKey, "wrong alloc")
+       alloc2.released = false
+
        // setting priority offset on parent2 queue should remove leaf2 victims
        parent2.priorityOffset = 1001
        snapshot = leaf1.FindEligiblePreemptionVictims(leaf1.QueuePath, ask)


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

Reply via email to