mitdesai commented on code in PR #515:
URL: https://github.com/apache/yunikorn-core/pull/515#discussion_r1152499224
##########
pkg/common/configs/configvalidator.go:
##########
@@ -357,13 +357,32 @@ func checkLimit(limit Limit, currIdx int,
userWildCardIdx, groupWildCardIdx *int
}
// at least some resource should be not null
if limit.MaxApplications == 0 && resources.IsZero(limitResource) {
- return fmt.Errorf("invalid resource combination for limit names
'%s' all resource limits are null", limit.Users)
+ return fmt.Errorf("invalid resource combination for limit user
names '%s' groups %s all resource limits are null", limit.Users, limit.Groups)
}
+
+ if queue.MaxApplications != 0 && (limit.MaxApplications >
queue.MaxApplications || limit.MaxApplications == 0) {
+ return fmt.Errorf("invalid MaxApplications settings for limit
user names '%s' groups %s exeecd current the queue MaxApplications",
limit.Users, limit.Groups)
Review Comment:
Same comment as above. Also needs rewording
##########
pkg/common/configs/configvalidator.go:
##########
@@ -357,13 +357,32 @@ func checkLimit(limit Limit, currIdx int,
userWildCardIdx, groupWildCardIdx *int
}
// at least some resource should be not null
if limit.MaxApplications == 0 && resources.IsZero(limitResource) {
- return fmt.Errorf("invalid resource combination for limit names
'%s' all resource limits are null", limit.Users)
+ return fmt.Errorf("invalid resource combination for limit user
names '%s' groups %s all resource limits are null", limit.Users, limit.Groups)
Review Comment:
Can we add limit.Limit instead of listing out users and groups? List of
users and groups has a possibility of getting too big
##########
pkg/common/configs/configvalidator.go:
##########
@@ -357,13 +357,32 @@ func checkLimit(limit Limit, currIdx int,
userWildCardIdx, groupWildCardIdx *int
}
// at least some resource should be not null
if limit.MaxApplications == 0 && resources.IsZero(limitResource) {
- return fmt.Errorf("invalid resource combination for limit names
'%s' all resource limits are null", limit.Users)
+ return fmt.Errorf("invalid resource combination for limit user
names '%s' groups %s all resource limits are null", limit.Users, limit.Groups)
}
+
+ if queue.MaxApplications != 0 && (limit.MaxApplications >
queue.MaxApplications || limit.MaxApplications == 0) {
+ return fmt.Errorf("invalid MaxApplications settings for limit
user names '%s' groups %s exeecd current the queue MaxApplications",
limit.Users, limit.Groups)
+ }
+
+ // If queue is RootQueue, the queue.Resources.Max will be null, we
don't need to check for root queue
+ // But we may need to check the root resource during loading the config
and after partition resource loading when update node
+ if queue.Name != RootQueue {
+ queueMaxResource, err :=
resources.NewResourceFromConf(queue.Resources.Max)
+ if err != nil {
+ log.Logger().Debug("resource parsing failed",
+ zap.Error(err))
+ return fmt.Errorf("parse queue max resource failed:
%s", err.Error())
+ }
+ if !queueMaxResource.FitInMaxUndef(limitResource) {
+ return fmt.Errorf("invalid MaxResources settings for
limit user names '%s' groups %s exeecd current the queue MaxResources",
limit.Users, limit.Groups)
Review Comment:
this too can be changed to limit description
##########
pkg/common/configs/configvalidator.go:
##########
@@ -357,13 +357,32 @@ func checkLimit(limit Limit, currIdx int,
userWildCardIdx, groupWildCardIdx *int
}
// at least some resource should be not null
if limit.MaxApplications == 0 && resources.IsZero(limitResource) {
- return fmt.Errorf("invalid resource combination for limit names
'%s' all resource limits are null", limit.Users)
+ return fmt.Errorf("invalid resource combination for limit user
names '%s' groups %s all resource limits are null", limit.Users, limit.Groups)
}
+
+ if queue.MaxApplications != 0 && (limit.MaxApplications >
queue.MaxApplications || limit.MaxApplications == 0) {
+ return fmt.Errorf("invalid MaxApplications settings for limit
user names '%s' groups %s exeecd current the queue MaxApplications",
limit.Users, limit.Groups)
+ }
+
+ // If queue is RootQueue, the queue.Resources.Max will be null, we
don't need to check for root queue
+ // But we may need to check the root resource during loading the config
and after partition resource loading when update node
+ if queue.Name != RootQueue {
+ queueMaxResource, err :=
resources.NewResourceFromConf(queue.Resources.Max)
+ if err != nil {
+ log.Logger().Debug("resource parsing failed",
+ zap.Error(err))
+ return fmt.Errorf("parse queue max resource failed:
%s", err.Error())
Review Comment:
+1 on having the queue name. It will be very helpful to identify which queue
configuration is causing the issue
--
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]