This is an automated email from the ASF dual-hosted git repository.
ccondit 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 5aa780a6 [YUNIKORN-2991] Ensure draining queues do not accept new
applications (#1002)
5aa780a6 is described below
commit 5aa780a651b467e7580617a7439173e2146a30bb
Author: haorenhui <[email protected]>
AuthorDate: Thu Feb 20 11:32:12 2025 -0600
[YUNIKORN-2991] Ensure draining queues do not accept new applications
(#1002)
Closes: #1002
Signed-off-by: Craig Condit <[email protected]>
---
pkg/scheduler/placement/placement.go | 10 ++++++++++
pkg/scheduler/placement/placement_test.go | 9 +++++++++
2 files changed, 19 insertions(+)
diff --git a/pkg/scheduler/placement/placement.go
b/pkg/scheduler/placement/placement.go
index 31b6f406..c6c6d420 100644
--- a/pkg/scheduler/placement/placement.go
+++ b/pkg/scheduler/placement/placement.go
@@ -188,6 +188,16 @@ func (m *AppPlacementManager) PlaceApplication(app
*objects.Application) error {
queueName = ""
continue
}
+ // Check if the queue in Draining state, and if so,
proceed to the next rule
+ if queue.IsDraining() {
+ log.Log(log.SchedApplication).Debug("Cannot
place application in draining queue",
+ zap.String("queueName", queueName),
+ zap.String("ruleName",
checkRule.getName()),
+ zap.String("application",
app.ApplicationID))
+ // reset the queue name for the last rule in
the chain
+ queueName = ""
+ continue
+ }
}
// we have a queue that allows submitting and can be created:
app placed
log.Log(log.SchedApplication).Info("Rule result for placing
application",
diff --git a/pkg/scheduler/placement/placement_test.go
b/pkg/scheduler/placement/placement_test.go
index add7def8..0d488d68 100644
--- a/pkg/scheduler/placement/placement_test.go
+++ b/pkg/scheduler/placement/placement_test.go
@@ -323,6 +323,15 @@ partitions:
if err == nil || queueName != "" {
t.Errorf("parent queue: app should not have been placed, queue:
'%s', error: %v", queueName, err)
}
+
+ // provided rule (2nd): submit to draining queue
+ app = newApplication("app1", "default", "root.testparent.testchild",
user, nil, nil, "")
+ man.queueFn("root.testparent.testchild").MarkQueueForRemoval()
+ err = man.PlaceApplication(app)
+ queueName = app.GetQueuePath()
+ if err == nil || queueName != "" {
+ t.Errorf("draining queue: app should not have been placed,
queue: '%s', error: %v", queueName, err)
+ }
}
//nolint:funlen
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]