p-szucs commented on code in PR #5332:
URL: https://github.com/apache/hadoop/pull/5332#discussion_r1232482290
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AutoCreatedQueueTemplate.java:
##########
@@ -154,46 +148,26 @@ public void
setTemplateEntriesForChild(CapacitySchedulerConfiguration conf,
*/
private void setTemplateConfigEntries(CapacitySchedulerConfiguration
configuration,
QueuePath queuePath) {
- ConfigurationProperties configurationProperties =
- configuration.getConfigurationProperties();
-
- List<String> queuePathParts = Lists.newArrayList(queuePath.iterator());
-
- if (queuePathParts.size() <= 1 && !queuePath.isRoot()) {
- // This is an invalid queue path
- return;
- }
- int queuePathMaxIndex = queuePathParts.size() - 1;
-
- // start with the most explicit format (without wildcard)
- int wildcardLevel = 0;
- // root can not be wildcarded
- int supportedWildcardLevel = Math.min(queuePathMaxIndex,
-
configuration.getMaximumAutoCreatedQueueDepth(queuePath.getFullPath()));
- // Allow root to have template properties
- if (queuePath.isRoot()) {
- supportedWildcardLevel = 0;
- }
-
- // Collect all template entries
- while (wildcardLevel <= supportedWildcardLevel) {
- String templateQueuePath = String.join(".", queuePathParts);
- // Get all configuration entries with
- // yarn.scheduler.capacity.<queuePath> prefix
- Map<String, String> queueProps = configurationProperties
- .getPropertiesWithPrefix(getQueuePrefix(templateQueuePath));
-
- // Store template, parent-template and leaf-template properties
- for (Map.Entry<String, String> entry : queueProps.entrySet()) {
- storeConfiguredTemplates(entry.getKey(), entry.getValue());
+ if (!queuePath.isInvalid()) {
+ ConfigurationProperties configurationProperties =
+ configuration.getConfigurationProperties();
+
+ int maxAutoCreatedQueueDepth = configuration
+ .getMaximumAutoCreatedQueueDepth(queuePath);
+ List<QueuePath> wildcardedQueuePaths =
+ queuePath.getWildcardedQueuePaths(maxAutoCreatedQueueDepth);
+
+ for (QueuePath templateQueuePath: wildcardedQueuePaths) {
+ // Get all configuration entries with
+ // yarn.scheduler.capacity.<queuePath> prefix
+ Map<String, String> queueProps = configurationProperties
+ .getPropertiesWithPrefix(getQueuePrefix(templateQueuePath));
+
+ // Store template, parent-template and leaf-template properties
+ for (Map.Entry<String, String> entry : queueProps.entrySet()) {
+ storeConfiguredTemplates(entry.getKey(), entry.getValue());
+ }
Review Comment:
I extended the tests with cases when autoCreatedQueueDepth config is not the
default value, but its limited. It could also affect how deep we should check
the wildcarded template properties for a queue path. Added one test case with
invalid queue path too.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]