|
@@ -26,6 +26,7 @@ import org.junit.Before;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
+import static org.junit.Assert.assertFalse;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
/**
|
|
@@ -52,7 +53,8 @@ public class TestFSYarnSiteConverter {
|
|
|
yarnConfig.setInt(
|
|
|
FairSchedulerConfiguration.CONTINUOUS_SCHEDULING_SLEEP_MS, 666);
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertTrue("Cont. scheduling", yarnConvertedConfig.getBoolean(
|
|
|
CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_ENABLE, false));
|
|
@@ -67,7 +69,7 @@ public class TestFSYarnSiteConverter {
|
|
|
yarnConfig.setInt("yarn.resource-types.memory-mb.increment-allocation", 11);
|
|
|
yarnConfig.setInt("yarn.resource-types.vcores.increment-allocation", 5);
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false, false);
|
|
|
|
|
|
assertEquals("Memory alloc increment", 11,
|
|
|
yarnConvertedConfig.getInt("yarn.scheduler.minimum-allocation-mb",
|
|
@@ -85,7 +87,8 @@ public class TestFSYarnSiteConverter {
|
|
|
FairSchedulerConfiguration.WAIT_TIME_BEFORE_NEXT_STARVATION_CHECK_MS,
|
|
|
321);
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertTrue("Preemption enabled",
|
|
|
yarnConvertedConfig.getBoolean(
|
|
@@ -105,7 +108,8 @@ public class TestFSYarnSiteConverter {
|
|
|
public void testSiteAssignMultipleConversion() {
|
|
|
yarnConfig.setBoolean(FairSchedulerConfiguration.ASSIGN_MULTIPLE, true);
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertTrue("Assign multiple",
|
|
|
yarnConvertedConfig.getBoolean(
|
|
@@ -117,7 +121,8 @@ public class TestFSYarnSiteConverter {
|
|
|
public void testSiteMaxAssignConversion() {
|
|
|
yarnConfig.setInt(FairSchedulerConfiguration.MAX_ASSIGN, 111);
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertEquals("Max assign", 111,
|
|
|
yarnConvertedConfig.getInt(
|
|
@@ -131,7 +136,8 @@ public class TestFSYarnSiteConverter {
|
|
|
yarnConfig.set(FairSchedulerConfiguration.LOCALITY_THRESHOLD_RACK,
|
|
|
"321.321");
|
|
|
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertEquals("Locality threshold node", "123.123",
|
|
|
yarnConvertedConfig.get(
|
|
@@ -143,7 +149,8 @@ public class TestFSYarnSiteConverter {
|
|
|
|
|
|
@Test
|
|
|
public void testSiteDrfEnabledConversion() {
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, true);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, true,
|
|
|
+ false);
|
|
|
|
|
|
assertEquals("Resource calculator type", DominantResourceCalculator.class,
|
|
|
yarnConvertedConfig.getClass(
|
|
@@ -152,11 +159,32 @@ public class TestFSYarnSiteConverter {
|
|
|
|
|
|
@Test
|
|
|
public void testSiteDrfDisabledConversion() {
|
|
|
- converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false);
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
|
|
|
assertEquals("Resource calculator type", DefaultResourceCalculator.class,
|
|
|
yarnConvertedConfig.getClass(
|
|
|
CapacitySchedulerConfiguration.RESOURCE_CALCULATOR_CLASS,
|
|
|
CapacitySchedulerConfiguration.DEFAULT_RESOURCE_CALCULATOR_CLASS));
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testAsyncSchedulingEnabledConversion() {
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, true,
|
|
|
+ true);
|
|
|
+
|
|
|
+ assertTrue("Asynchronous scheduling", yarnConvertedConfig.getBoolean(
|
|
|
+ CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_ENABLE,
|
|
|
+ CapacitySchedulerConfiguration.DEFAULT_SCHEDULE_ASYNCHRONOUSLY_ENABLE));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testAsyncSchedulingDisabledConversion() {
|
|
|
+ converter.convertSiteProperties(yarnConfig, yarnConvertedConfig, false,
|
|
|
+ false);
|
|
|
+
|
|
|
+ assertFalse("Asynchronous scheduling", yarnConvertedConfig.getBoolean(
|
|
|
+ CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_ENABLE,
|
|
|
+ CapacitySchedulerConfiguration.DEFAULT_SCHEDULE_ASYNCHRONOUSLY_ENABLE));
|
|
|
+ }
|
|
|
}
|