YARN-4805. Don't go through all schedulers in ParameterizedTestBase. (kasha)
This commit is contained in:
parent
3a4ff7776e
commit
49ff54c860
@ -23,19 +23,13 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public abstract class ParameterizedSchedulerTestBase {
|
public abstract class ParameterizedSchedulerTestBase {
|
||||||
protected final static String TEST_DIR =
|
protected final static String TEST_DIR =
|
||||||
new File(System.getProperty("test.build.data", "/tmp")).getAbsolutePath();
|
new File(System.getProperty("test.build.data", "/tmp")).getAbsolutePath();
|
||||||
@ -49,31 +43,23 @@ public enum SchedulerType {
|
|||||||
CAPACITY, FAIR
|
CAPACITY, FAIR
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParameterizedSchedulerTestBase(SchedulerType type) {
|
|
||||||
schedulerType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public YarnConfiguration getConf() {
|
public YarnConfiguration getConf() {
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameterized.Parameters
|
|
||||||
public static Collection<SchedulerType[]> getParameters() {
|
|
||||||
return Arrays.asList(new SchedulerType[][]{
|
|
||||||
{SchedulerType.CAPACITY}, {SchedulerType.FAIR}});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void configureScheduler() throws IOException {
|
public void configureScheduler() throws IOException, ClassNotFoundException {
|
||||||
conf = new YarnConfiguration();
|
conf = new YarnConfiguration();
|
||||||
switch (schedulerType) {
|
|
||||||
case CAPACITY:
|
Class schedulerClass =
|
||||||
conf.set(YarnConfiguration.RM_SCHEDULER,
|
conf.getClass(YarnConfiguration.RM_SCHEDULER,
|
||||||
CapacityScheduler.class.getName());
|
Class.forName(YarnConfiguration.DEFAULT_RM_SCHEDULER));
|
||||||
break;
|
|
||||||
case FAIR:
|
if (schedulerClass == FairScheduler.class) {
|
||||||
configureFairScheduler(conf);
|
schedulerType = SchedulerType.FAIR;
|
||||||
break;
|
configureFairScheduler(conf);
|
||||||
|
} else if (schedulerClass == CapacityScheduler.class) {
|
||||||
|
schedulerType = SchedulerType.CAPACITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +91,6 @@ public class TestRM extends ParameterizedSchedulerTestBase {
|
|||||||
|
|
||||||
private YarnConfiguration conf;
|
private YarnConfiguration conf;
|
||||||
|
|
||||||
public TestRM(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
conf = getConf();
|
conf = getConf();
|
||||||
|
@ -136,10 +136,6 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
|
|||||||
private static InetSocketAddress rmAddr;
|
private static InetSocketAddress rmAddr;
|
||||||
private List<MockRM> rms = new ArrayList<MockRM>();
|
private List<MockRM> rms = new ArrayList<MockRM>();
|
||||||
|
|
||||||
public TestRMRestart(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws IOException {
|
public void setup() throws IOException {
|
||||||
conf = getConf();
|
conf = getConf();
|
||||||
|
@ -89,7 +89,6 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer;
|
||||||
import org.apache.hadoop.yarn.util.ControlledClock;
|
import org.apache.hadoop.yarn.util.ControlledClock;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
import org.apache.hadoop.yarn.util.SystemClock;
|
|
||||||
import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
|
import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
|
||||||
import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
|
import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
@ -100,23 +99,15 @@
|
|||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@RunWith(value = Parameterized.class)
|
|
||||||
public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase {
|
public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase {
|
||||||
|
|
||||||
private YarnConfiguration conf;
|
private YarnConfiguration conf;
|
||||||
MockRM rm1 = null;
|
MockRM rm1 = null;
|
||||||
MockRM rm2 = null;
|
MockRM rm2 = null;
|
||||||
|
|
||||||
public TestWorkPreservingRMRestart(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws UnknownHostException {
|
public void setup() throws UnknownHostException {
|
||||||
Logger rootLogger = LogManager.getRootLogger();
|
Logger rootLogger = LogManager.getRootLogger();
|
||||||
|
@ -53,10 +53,6 @@ public class TestReservationSystem extends
|
|||||||
private Configuration conf;
|
private Configuration conf;
|
||||||
private RMContext mockRMContext;
|
private RMContext mockRMContext;
|
||||||
|
|
||||||
public TestReservationSystem(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws IOException {
|
public void setUp() throws IOException {
|
||||||
scheduler = initializeScheduler();
|
scheduler = initializeScheduler();
|
||||||
|
@ -83,10 +83,6 @@
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class TestAbstractYarnScheduler extends ParameterizedSchedulerTestBase {
|
public class TestAbstractYarnScheduler extends ParameterizedSchedulerTestBase {
|
||||||
|
|
||||||
public TestAbstractYarnScheduler(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMaximimumAllocationMemory() throws Exception {
|
public void testMaximimumAllocationMemory() throws Exception {
|
||||||
final int node1MaxMemory = 15 * 1024;
|
final int node1MaxMemory = 15 * 1024;
|
||||||
@ -268,7 +264,6 @@ public void testUpdateMaxAllocationUsesTotal() throws IOException {
|
|||||||
Resource configuredMaximumResource = Resource.newInstance
|
Resource configuredMaximumResource = Resource.newInstance
|
||||||
(configuredMaxMemory, configuredMaxVCores);
|
(configuredMaxMemory, configuredMaxVCores);
|
||||||
|
|
||||||
configureScheduler();
|
|
||||||
YarnConfiguration conf = getConf();
|
YarnConfiguration conf = getConf();
|
||||||
conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
|
conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
|
||||||
configuredMaxVCores);
|
configuredMaxVCores);
|
||||||
@ -323,7 +318,6 @@ public void testMaxAllocationAfterUpdateNodeResource() throws IOException {
|
|||||||
Resource configuredMaximumResource = Resource.newInstance
|
Resource configuredMaximumResource = Resource.newInstance
|
||||||
(configuredMaxMemory, configuredMaxVCores);
|
(configuredMaxMemory, configuredMaxVCores);
|
||||||
|
|
||||||
configureScheduler();
|
|
||||||
YarnConfiguration conf = getConf();
|
YarnConfiguration conf = getConf();
|
||||||
conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
|
conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES,
|
||||||
configuredMaxVCores);
|
configuredMaxVCores);
|
||||||
|
@ -84,10 +84,6 @@
|
|||||||
public class TestClientToAMTokens extends ParameterizedSchedulerTestBase {
|
public class TestClientToAMTokens extends ParameterizedSchedulerTestBase {
|
||||||
private YarnConfiguration conf;
|
private YarnConfiguration conf;
|
||||||
|
|
||||||
public TestClientToAMTokens(SchedulerType type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
conf = getConf();
|
conf = getConf();
|
||||||
|
Loading…
Reference in New Issue
Block a user