manirajv06 commented on code in PR #943:
URL: https://github.com/apache/yunikorn-core/pull/943#discussion_r1715417693
##########
pkg/scheduler/objects/queue_test.go:
##########
@@ -1052,60 +1052,58 @@ func TestIsEmpty(t *testing.T) {
func TestGetOutstandingRequestMax(t *testing.T) {
// queue structure:
- // root
+ // root (max.cpu = 5)
Review Comment:
This is bit confusing especially with "root max is irrelevant for the
calculation" comment. My understanding is, root max res has been set based on
the actual usage just to satisfy root Q fitIn operation.
##########
pkg/scheduler/objects/queue.go:
##########
@@ -1028,6 +1028,12 @@ func (sq *Queue) IncAllocatedResource(alloc
*resources.Resource, nodeReported bo
func (sq *Queue) allocatedResFits(alloc *resources.Resource) bool {
sq.RLock()
defer sq.RUnlock()
+ // on the root we want to reject a new allocation if it asks for
resources not registered
+ // so do not use the "undefined" flag, also handles pruned max for root
+ if sq.isRoot() {
+ return sq.maxResource.FitIn(resources.AddOnlyExisting(alloc,
sq.allocatedResource))
+ }
+ // any other queue undefined is always good
Review Comment:
Can we have a single line check for all queues? Is Internal FitIn method
private? Can it be made public?
##########
pkg/scheduler/objects/queue_test.go:
##########
@@ -1176,10 +1173,11 @@ func TestGetOutstandingOnlyUntracked(t *testing.T) {
alloc, err := resources.NewResourceFromConf(map[string]string{"pods":
"1"})
assert.NilError(t, err, "failed to create basic resource")
var used *resources.Resource
- used, err = resources.NewResourceFromConf(map[string]string{"cpu":
"10", "pods": "10"})
+ usedMap := map[string]string{"cpu": "10", "pods": "10"}
+ used, err = resources.NewResourceFromConf(usedMap)
assert.NilError(t, err, "failed to create basic resource")
var root, queue1 *Queue
- root, err = createRootQueue(nil)
+ root, err = createRootQueue(usedMap)
Review Comment:
Can we edit root max cpu in Queue structure like earlier?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]