Skip to content

Commit 5aa780a

Browse files
rhh777craigcondit
authored andcommitted
[YUNIKORN-2991] Ensure draining queues do not accept new applications (#1002)
Closes: #1002 Signed-off-by: Craig Condit <[email protected]>
1 parent 84bb8e0 commit 5aa780a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pkg/scheduler/placement/placement.go

+10
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ func (m *AppPlacementManager) PlaceApplication(app *objects.Application) error {
188188
queueName = ""
189189
continue
190190
}
191+
// Check if the queue in Draining state, and if so, proceed to the next rule
192+
if queue.IsDraining() {
193+
log.Log(log.SchedApplication).Debug("Cannot place application in draining queue",
194+
zap.String("queueName", queueName),
195+
zap.String("ruleName", checkRule.getName()),
196+
zap.String("application", app.ApplicationID))
197+
// reset the queue name for the last rule in the chain
198+
queueName = ""
199+
continue
200+
}
191201
}
192202
// we have a queue that allows submitting and can be created: app placed
193203
log.Log(log.SchedApplication).Info("Rule result for placing application",

pkg/scheduler/placement/placement_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ partitions:
323323
if err == nil || queueName != "" {
324324
t.Errorf("parent queue: app should not have been placed, queue: '%s', error: %v", queueName, err)
325325
}
326+
327+
// provided rule (2nd): submit to draining queue
328+
app = newApplication("app1", "default", "root.testparent.testchild", user, nil, nil, "")
329+
man.queueFn("root.testparent.testchild").MarkQueueForRemoval()
330+
err = man.PlaceApplication(app)
331+
queueName = app.GetQueuePath()
332+
if err == nil || queueName != "" {
333+
t.Errorf("draining queue: app should not have been placed, queue: '%s', error: %v", queueName, err)
334+
}
326335
}
327336

328337
//nolint:funlen

0 commit comments

Comments
 (0)