pbacsko commented on code in PR #838:
URL: https://github.com/apache/yunikorn-core/pull/838#discussion_r1568747687
##########
pkg/scheduler/objects/application.go:
##########
@@ -2118,3 +2119,34 @@ func (sa *Application)
updateRunnableStatus(runnableInQueue, runnableByUserLimit
}
sa.runnableByUserLimit = runnableByUserLimit
}
+
+// GetGuaranteedResource returns the guaranteed resource that was set in the
application tags
+func (sa *Application) GetGuaranteedResource() *resources.Resource {
+ return
sa.getResourceFromTags(siCommon.AppTagNamespaceResourceGuaranteed)
+}
+
+// GetMaxResource returns the max resource that was set in the application tags
+func (sa *Application) GetMaxResource() *resources.Resource {
+ return sa.getResourceFromTags(siCommon.AppTagNamespaceResourceQuota)
+}
+
+func (sa *Application) getResourceFromTags(tag string) *resources.Resource {
+ value := sa.GetTag(tag)
+ if value == "" {
+ return nil
+ }
+
+ resource, err := resources.NewResourceFromString(value)
+ if err != nil {
+ log.Log(log.SchedQueue).Warn("application resource conversion
failure",
+ zap.String("tag", tag),
+ zap.String("json string", value),
+ zap.Error(err))
+ } else if !resources.StrictlyGreaterThanZero(resource) {
+ log.Log(log.SchedQueue).Warn("resource quantities should be
greater than zero",
+ zap.Stringer("maxResource", resource))
Review Comment:
Fixed
##########
pkg/scheduler/partition.go:
##########
@@ -339,26 +339,27 @@ 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
+ if !queue.IsManaged() {
+ queue.SetResources(app.GetGuaranteedResource(),
app.GetMaxResource())
Review Comment:
It's printed now
--
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]