YARN-10157. FS-CS converter: initPropertyActions() is not called without rules file. Contributed by Peter Bacsko
This commit is contained in:
parent
929004074f
commit
34cf63c7d0
@ -166,11 +166,13 @@ private Resource getClusterResource(
|
|||||||
private void loadConversionRules(String rulesFile) throws IOException {
|
private void loadConversionRules(String rulesFile) throws IOException {
|
||||||
if (rulesFile != null) {
|
if (rulesFile != null) {
|
||||||
LOG.info("Reading conversion rules file from: " + rulesFile);
|
LOG.info("Reading conversion rules file from: " + rulesFile);
|
||||||
this.ruleHandler.loadRulesFromFile(rulesFile);
|
ruleHandler.loadRulesFromFile(rulesFile);
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Conversion rules file is not defined, " +
|
LOG.info("Conversion rules file is not defined, " +
|
||||||
"using default conversion config!");
|
"using default conversion config!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ruleHandler.initPropertyActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration getInputYarnSiteConfig(
|
private Configuration getInputYarnSiteConfig(
|
||||||
|
@ -95,7 +95,6 @@ void loadRulesFromFile(String ruleFile) throws IOException {
|
|||||||
properties.load(is);
|
properties.load(is);
|
||||||
}
|
}
|
||||||
actions = new HashMap<>();
|
actions = new HashMap<>();
|
||||||
initPropertyActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FSConfigToCSConfigRuleHandler(ConversionOptions conversionOptions) {
|
public FSConfigToCSConfigRuleHandler(ConversionOptions conversionOptions) {
|
||||||
@ -113,7 +112,7 @@ public FSConfigToCSConfigRuleHandler(ConversionOptions conversionOptions) {
|
|||||||
initPropertyActions();
|
initPropertyActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPropertyActions() {
|
public void initPropertyActions() {
|
||||||
setActionForProperty(MAX_CAPACITY_PERCENTAGE);
|
setActionForProperty(MAX_CAPACITY_PERCENTAGE);
|
||||||
setActionForProperty(MAX_CHILD_CAPACITY);
|
setActionForProperty(MAX_CHILD_CAPACITY);
|
||||||
setActionForProperty(USER_MAX_RUNNING_APPS);
|
setActionForProperty(USER_MAX_RUNNING_APPS);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_APPS_DEFAULT;
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_APPS_DEFAULT;
|
||||||
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_RUNNING_APPS;
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.USER_MAX_RUNNING_APPS;
|
||||||
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RuleAction.ABORT;
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RuleAction.ABORT;
|
||||||
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.FSConfigToCSConfigRuleHandler.RuleAction.WARNING;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -372,6 +373,41 @@ public void testConvertFSConfigurationRulesFile() throws Exception {
|
|||||||
ABORT, actions.get(QUEUE_AUTO_CREATE));
|
ABORT, actions.get(QUEUE_AUTO_CREATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConvertFSConfigurationWithoutRulesFile() throws Exception {
|
||||||
|
ruleHandler = new FSConfigToCSConfigRuleHandler(
|
||||||
|
createDefaultConversionOptions());
|
||||||
|
createConverter();
|
||||||
|
|
||||||
|
FSConfigToCSConfigConverterParams params =
|
||||||
|
createDefaultParamsBuilder()
|
||||||
|
.withClusterResource(CLUSTER_RESOURCE_STRING)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
converter.convert(params);
|
||||||
|
|
||||||
|
ruleHandler = converter.getRuleHandler();
|
||||||
|
Map<String, FSConfigToCSConfigRuleHandler.RuleAction> actions =
|
||||||
|
ruleHandler.getActions();
|
||||||
|
|
||||||
|
assertEquals("maxCapacityPercentage",
|
||||||
|
WARNING, actions.get(MAX_CAPACITY_PERCENTAGE));
|
||||||
|
assertEquals("maxChildCapacity",
|
||||||
|
WARNING, actions.get(MAX_CHILD_CAPACITY));
|
||||||
|
assertEquals("userMaxRunningApps",
|
||||||
|
WARNING, actions.get(USER_MAX_RUNNING_APPS));
|
||||||
|
assertEquals("userMaxAppsDefault",
|
||||||
|
WARNING, actions.get(USER_MAX_APPS_DEFAULT));
|
||||||
|
assertEquals("dynamicMaxAssign",
|
||||||
|
WARNING, actions.get(DYNAMIC_MAX_ASSIGN));
|
||||||
|
assertEquals("specifiedNotFirstRule",
|
||||||
|
WARNING, actions.get(SPECIFIED_NOT_FIRST));
|
||||||
|
assertEquals("reservationSystem",
|
||||||
|
WARNING, actions.get(RESERVATION_SYSTEM));
|
||||||
|
assertEquals("queueAutoCreate",
|
||||||
|
WARNING, actions.get(QUEUE_AUTO_CREATE));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConvertFSConfigurationUndefinedYarnSiteConfig()
|
public void testConvertFSConfigurationUndefinedYarnSiteConfig()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
Loading…
Reference in New Issue
Block a user