Revert "YARN-5007. Remove deprecated constructors of MiniYARNCluster and MiniMRYarnCluster. Contributed by Andras Bokor."
This reverts commit 34ab8e73d4
.
This commit is contained in:
parent
9ccb849eb6
commit
8a99eba96d
|
@ -203,7 +203,7 @@ public class TestMRTimelineEventHandling {
|
||||||
MiniMRYarnCluster cluster = null;
|
MiniMRYarnCluster cluster = null;
|
||||||
try {
|
try {
|
||||||
cluster = new MiniMRYarnCluster(
|
cluster = new MiniMRYarnCluster(
|
||||||
TestMRTimelineEventHandling.class.getSimpleName(), 1);
|
TestMRTimelineEventHandling.class.getSimpleName(), 1, true);
|
||||||
cluster.init(conf);
|
cluster.init(conf);
|
||||||
cluster.start();
|
cluster.start();
|
||||||
LOG.info("A MiniMRYarnCluster get start.");
|
LOG.info("A MiniMRYarnCluster get start.");
|
||||||
|
|
|
@ -74,7 +74,11 @@ public class MiniMRYarnCluster extends MiniYARNCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MiniMRYarnCluster(String testName, int noOfNMs) {
|
public MiniMRYarnCluster(String testName, int noOfNMs) {
|
||||||
super(testName, 1, noOfNMs, 4, 4);
|
this(testName, noOfNMs, false);
|
||||||
|
}
|
||||||
|
@Deprecated
|
||||||
|
public MiniMRYarnCluster(String testName, int noOfNMs, boolean enableAHS) {
|
||||||
|
super(testName, 1, noOfNMs, 4, 4, enableAHS);
|
||||||
historyServerWrapper = new JobHistoryServerWrapper();
|
historyServerWrapper = new JobHistoryServerWrapper();
|
||||||
addService(historyServerWrapper);
|
addService(historyServerWrapper);
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ public abstract class ProtocolHATestBase extends ClientBaseWithFixes {
|
||||||
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
|
||||||
cluster =
|
cluster =
|
||||||
new MiniYARNClusterForHATesting(TestRMFailover.class.getName(), 2,
|
new MiniYARNClusterForHATesting(TestRMFailover.class.getName(), 2,
|
||||||
numOfNMs, 1, 1, overrideClientRMService, overrideRTS,
|
numOfNMs, 1, 1, false, overrideClientRMService, overrideRTS,
|
||||||
overrideApplicationMasterService);
|
overrideApplicationMasterService);
|
||||||
cluster.resetStartFailoverFlag(false);
|
cluster.resetStartFailoverFlag(false);
|
||||||
cluster.init(conf);
|
cluster.init(conf);
|
||||||
|
@ -304,10 +304,10 @@ public abstract class ProtocolHATestBase extends ClientBaseWithFixes {
|
||||||
|
|
||||||
public MiniYARNClusterForHATesting(String testName,
|
public MiniYARNClusterForHATesting(String testName,
|
||||||
int numResourceManagers, int numNodeManagers, int numLocalDirs,
|
int numResourceManagers, int numNodeManagers, int numLocalDirs,
|
||||||
int numLogDirs, boolean overrideClientRMService,
|
int numLogDirs, boolean enableAHS, boolean overrideClientRMService,
|
||||||
boolean overrideRTS, boolean overrideApplicationMasterService) {
|
boolean overrideRTS, boolean overrideApplicationMasterService) {
|
||||||
super(testName, numResourceManagers, numNodeManagers, numLocalDirs,
|
super(testName, numResourceManagers, numNodeManagers, numLocalDirs,
|
||||||
numLogDirs);
|
numLogDirs, enableAHS);
|
||||||
this.overrideClientRMService = overrideClientRMService;
|
this.overrideClientRMService = overrideClientRMService;
|
||||||
this.overrideRTS = overrideRTS;
|
this.overrideRTS = overrideRTS;
|
||||||
this.overrideApplicationMasterService = overrideApplicationMasterService;
|
this.overrideApplicationMasterService = overrideApplicationMasterService;
|
||||||
|
|
|
@ -146,6 +146,7 @@ public class MiniYARNCluster extends CompositeService {
|
||||||
private int numLocalDirs;
|
private int numLocalDirs;
|
||||||
// Number of nm-log-dirs per nodemanager
|
// Number of nm-log-dirs per nodemanager
|
||||||
private int numLogDirs;
|
private int numLogDirs;
|
||||||
|
private boolean enableAHS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param testName name of the test
|
* @param testName name of the test
|
||||||
|
@ -153,13 +154,16 @@ public class MiniYARNCluster extends CompositeService {
|
||||||
* @param numNodeManagers the number of node managers in the cluster
|
* @param numNodeManagers the number of node managers in the cluster
|
||||||
* @param numLocalDirs the number of nm-local-dirs per nodemanager
|
* @param numLocalDirs the number of nm-local-dirs per nodemanager
|
||||||
* @param numLogDirs the number of nm-log-dirs per nodemanager
|
* @param numLogDirs the number of nm-log-dirs per nodemanager
|
||||||
|
* @param enableAHS enable ApplicationHistoryServer or not
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public MiniYARNCluster(
|
public MiniYARNCluster(
|
||||||
String testName, int numResourceManagers, int numNodeManagers,
|
String testName, int numResourceManagers, int numNodeManagers,
|
||||||
int numLocalDirs, int numLogDirs) {
|
int numLocalDirs, int numLogDirs, boolean enableAHS) {
|
||||||
super(testName.replace("$", ""));
|
super(testName.replace("$", ""));
|
||||||
this.numLocalDirs = numLocalDirs;
|
this.numLocalDirs = numLocalDirs;
|
||||||
this.numLogDirs = numLogDirs;
|
this.numLogDirs = numLogDirs;
|
||||||
|
this.enableAHS = enableAHS;
|
||||||
String testSubDir = testName.replace("$", "");
|
String testSubDir = testName.replace("$", "");
|
||||||
File targetWorkDir = new File("target", testSubDir);
|
File targetWorkDir = new File("target", testSubDir);
|
||||||
try {
|
try {
|
||||||
|
@ -209,6 +213,20 @@ public class MiniYARNCluster extends CompositeService {
|
||||||
nodeManagers = new NodeManager[numNodeManagers];
|
nodeManagers = new NodeManager[numNodeManagers];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param testName name of the test
|
||||||
|
* @param numResourceManagers the number of resource managers in the cluster
|
||||||
|
* @param numNodeManagers the number of node managers in the cluster
|
||||||
|
* @param numLocalDirs the number of nm-local-dirs per nodemanager
|
||||||
|
* @param numLogDirs the number of nm-log-dirs per nodemanager
|
||||||
|
*/
|
||||||
|
public MiniYARNCluster(
|
||||||
|
String testName, int numResourceManagers, int numNodeManagers,
|
||||||
|
int numLocalDirs, int numLogDirs) {
|
||||||
|
this(testName, numResourceManagers, numNodeManagers, numLocalDirs,
|
||||||
|
numLogDirs, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param testName name of the test
|
* @param testName name of the test
|
||||||
* @param numNodeManagers the number of node managers in the cluster
|
* @param numNodeManagers the number of node managers in the cluster
|
||||||
|
@ -270,7 +288,7 @@ public class MiniYARNCluster extends CompositeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED,
|
if(conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED,
|
||||||
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) {
|
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED) || enableAHS) {
|
||||||
addService(new ApplicationHistoryServerWrapper());
|
addService(new ApplicationHistoryServerWrapper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,18 @@ public class TestMiniYarnCluster {
|
||||||
int numNodeManagers = 1;
|
int numNodeManagers = 1;
|
||||||
int numLocalDirs = 1;
|
int numLocalDirs = 1;
|
||||||
int numLogDirs = 1;
|
int numLogDirs = 1;
|
||||||
|
boolean enableAHS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timeline service should not start if TIMELINE_SERVICE_ENABLED == false
|
* Timeline service should not start if TIMELINE_SERVICE_ENABLED == false
|
||||||
|
* and enableAHS flag == false
|
||||||
*/
|
*/
|
||||||
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false);
|
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false);
|
||||||
|
enableAHS = false;
|
||||||
try (MiniYARNCluster cluster =
|
try (MiniYARNCluster cluster =
|
||||||
new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
|
new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
|
||||||
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs)) {
|
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs,
|
||||||
|
enableAHS)) {
|
||||||
|
|
||||||
cluster.init(conf);
|
cluster.init(conf);
|
||||||
cluster.start();
|
cluster.start();
|
||||||
|
@ -53,11 +57,14 @@ public class TestMiniYarnCluster {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timeline service should start if TIMELINE_SERVICE_ENABLED == true
|
* Timeline service should start if TIMELINE_SERVICE_ENABLED == true
|
||||||
|
* and enableAHS == false
|
||||||
*/
|
*/
|
||||||
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
|
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
|
||||||
|
enableAHS = false;
|
||||||
try (MiniYARNCluster cluster =
|
try (MiniYARNCluster cluster =
|
||||||
new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
|
new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
|
||||||
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs)) {
|
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs,
|
||||||
|
enableAHS)) {
|
||||||
cluster.init(conf);
|
cluster.init(conf);
|
||||||
|
|
||||||
// Verify that the timeline-service starts on ephemeral ports by default
|
// Verify that the timeline-service starts on ephemeral ports by default
|
||||||
|
@ -67,6 +74,29 @@ public class TestMiniYarnCluster {
|
||||||
|
|
||||||
cluster.start();
|
cluster.start();
|
||||||
|
|
||||||
|
//Timeline service may sometime take a while to get started
|
||||||
|
int wait = 0;
|
||||||
|
while(cluster.getApplicationHistoryServer() == null && wait < 20) {
|
||||||
|
Thread.sleep(500);
|
||||||
|
wait++;
|
||||||
|
}
|
||||||
|
//verify that the timeline service is started.
|
||||||
|
Assert.assertNotNull("Timeline Service should have been started",
|
||||||
|
cluster.getApplicationHistoryServer());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Timeline service should start if TIMELINE_SERVICE_ENABLED == false
|
||||||
|
* and enableAHS == true
|
||||||
|
*/
|
||||||
|
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false);
|
||||||
|
enableAHS = true;
|
||||||
|
try (MiniYARNCluster cluster =
|
||||||
|
new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
|
||||||
|
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs,
|
||||||
|
enableAHS)) {
|
||||||
|
cluster.init(conf);
|
||||||
|
cluster.start();
|
||||||
|
|
||||||
//Timeline service may sometime take a while to get started
|
//Timeline service may sometime take a while to get started
|
||||||
int wait = 0;
|
int wait = 0;
|
||||||
while(cluster.getApplicationHistoryServer() == null && wait < 20) {
|
while(cluster.getApplicationHistoryServer() == null && wait < 20) {
|
||||||
|
|
Loading…
Reference in New Issue