Skip to content

Commit

Permalink
[YUNIKORN-2991] The queue in Draining state should not accept new app…
Browse files Browse the repository at this point in the history
…lications
  • Loading branch information
rhh777 committed Dec 25, 2024
1 parent 36ff744 commit f3d2d18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/scheduler/placement/placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,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 Placing 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",
Expand Down
9 changes: 9 additions & 0 deletions pkg/scheduler/placement/placement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("Cannot Placing application in draining queue: '%s', error: %v", queueName, err)
}
}

//nolint:funlen
Expand Down

0 comments on commit f3d2d18

Please sign in to comment.