pbacsko commented on code in PR #838:
URL: https://github.com/apache/yunikorn-core/pull/838#discussion_r1570618978
##########
pkg/scheduler/partition.go:
##########
@@ -339,26 +339,29 @@ func (pc *PartitionContext) AddApplication(app
*objects.Application) error {
return fmt.Errorf("failed to find queue %s for application %s",
queueName, appID)
}
- // add the app to the queue to set the quota on the queue if needed
- queue.AddApplication(app)
+ // set resources based on tags, but only if the queue is dynamic
(unmanaged)
+ if queue.IsManaged() {
+ log.Log(log.SchedQueue).Warn("Trying to set resources on a
queue that is not an unmanaged leaf",
+ zap.String("queueName", queue.QueuePath))
+ } else {
+ queue.SetResources(app.GetGuaranteedResource(),
app.GetMaxResource())
+ }
// check only for gang request
// - make sure the taskgroup request fits in the maximum set for the
queue hierarchy
// - task groups should only be used in FIFO queues
// if the check fails remove the app from the queue again
if placeHolder := app.GetPlaceholderAsk();
!resources.IsZero(placeHolder) {
// check the queue sorting
if !queue.SupportTaskGroup() {
- queue.RemoveApplication(app)
return fmt.Errorf("queue %s cannot run application %s
with task group request: unsupported sort type", queueName, appID)
}
- // retrieve the max set
if maxQueue := queue.GetMaxQueueSet(); maxQueue != nil {
if !maxQueue.FitInMaxUndef(placeHolder) {
- queue.RemoveApplication(app)
return fmt.Errorf("queue %s cannot fit
application %s: task group request %s larger than max queue allocation %s",
queueName, appID, placeHolder.String(), maxQueue.String())
}
}
}
+ queue.AddApplication(app)
Review Comment:
Done
##########
pkg/scheduler/partition_test.go:
##########
@@ -2804,14 +2804,22 @@ func TestAddTGApplication(t *testing.T) {
partition, err := newLimitedPartition(limit)
assert.NilError(t, err, "partition create failed")
// add a app with TG that does not fit in the queue
- var tgRes *resources.Resource
- tgRes, err = resources.NewResourceFromConf(map[string]string{"vcore":
"10"})
+ tgRes, err := resources.NewResourceFromConf(map[string]string{"vcore":
"10"})
Review Comment:
Done
##########
pkg/scheduler/partition.go:
##########
@@ -339,26 +339,29 @@ func (pc *PartitionContext) AddApplication(app
*objects.Application) error {
return fmt.Errorf("failed to find queue %s for application %s",
queueName, appID)
}
- // add the app to the queue to set the quota on the queue if needed
- queue.AddApplication(app)
+ // set resources based on tags, but only if the queue is dynamic
(unmanaged)
+ if queue.IsManaged() {
+ log.Log(log.SchedQueue).Warn("Trying to set resources on a
queue that is not an unmanaged leaf",
+ zap.String("queueName", queue.QueuePath))
+ } else {
+ queue.SetResources(app.GetGuaranteedResource(),
app.GetMaxResource())
+ }
// check only for gang request
// - make sure the taskgroup request fits in the maximum set for the
queue hierarchy
// - task groups should only be used in FIFO queues
// if the check fails remove the app from the queue again
if placeHolder := app.GetPlaceholderAsk();
!resources.IsZero(placeHolder) {
// check the queue sorting
if !queue.SupportTaskGroup() {
- queue.RemoveApplication(app)
return fmt.Errorf("queue %s cannot run application %s
with task group request: unsupported sort type", queueName, appID)
}
- // retrieve the max set
if maxQueue := queue.GetMaxQueueSet(); maxQueue != nil {
if !maxQueue.FitInMaxUndef(placeHolder) {
- queue.RemoveApplication(app)
return fmt.Errorf("queue %s cannot fit
application %s: task group request %s larger than max queue allocation %s",
queueName, appID, placeHolder.String(), maxQueue.String())
}
}
}
+ queue.AddApplication(app)
// all is OK update the app and add it to the partition
app.SetQueue(queue)
Review Comment:
Done
--
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]