Merge -r 1362750:1362751 from trunk to branch. FIXES: MAPREDUCE-4406

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1362752 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2012-07-18 03:37:38 +00:00
parent 1aa9249c61
commit bd359a1a8e
5 changed files with 48 additions and 20 deletions

View File

@ -3,6 +3,9 @@ Hadoop MapReduce Change Log
MAPREDUCE-4422. YARN_APPLICATION_CLASSPATH needs a documented default value in
YarnConfiguration. (ahmed via tucu)
MAPREDUCE-4406. Users should be able to specify the MiniCluster ResourceManager
and JobHistoryServer ports. (ahmed via tucu)
Release 2.1.0-alpha - Unreleased
INCOMPATIBLE CHANGES

View File

@ -134,4 +134,15 @@ public class JHAdminConfig {
*/
public static final String MR_HISTORY_STORAGE =
MR_HISTORY_PREFIX + "store.class";
/** Whether to use fixed ports with the minicluster. */
public static final String MR_HISTORY_MINICLUSTER_FIXED_PORTS = MR_HISTORY_PREFIX
+ "minicluster.fixed.ports";
/**
* Default is false to be able to run tests concurrently without port
* conflicts.
*/
public static boolean DEFAULT_MR_HISTORY_MINICLUSTER_FIXED_PORTS = false;
}

View File

@ -113,10 +113,6 @@ public class MiniMRYarnCluster extends MiniYARNCluster {
// for corresponding uberized tests.
conf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, false);
// Set config for JH Server
conf.set(JHAdminConfig.MR_HISTORY_ADDRESS,
JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS);
super.init(conf);
}
@ -128,10 +124,15 @@ public class MiniMRYarnCluster extends MiniYARNCluster {
@Override
public synchronized void start() {
try {
if (!getConfig().getBoolean(
JHAdminConfig.MR_HISTORY_MINICLUSTER_FIXED_PORTS,
JHAdminConfig.DEFAULT_MR_HISTORY_MINICLUSTER_FIXED_PORTS)) {
// pick free random ports.
getConfig().set(JHAdminConfig.MR_HISTORY_ADDRESS,
MiniYARNCluster.getHostname() + ":0");
getConfig().set(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS,
MiniYARNCluster.getHostname() + ":0");
}
historyServer = new JobHistoryServer();
historyServer.init(getConfig());
new Thread() {

View File

@ -565,6 +565,16 @@ public class YarnConfiguration extends Configuration {
public static final String IS_MINI_YARN_CLUSTER = YARN_PREFIX + ".is.minicluster";
/** Whether to use fixed ports with the minicluster. */
public static final String YARN_MINICLUSTER_FIXED_PORTS = YARN_PREFIX
+ "minicluster.fixed.ports";
/**
* Default is false to be able to run tests concurrently without port
* conflicts.
*/
public static boolean DEFAULT_YARN_MINICLUSTER_FIXED_PORTS = false;
public YarnConfiguration() {
super();
}

View File

@ -135,8 +135,10 @@ public class MiniYARNCluster extends CompositeService {
public synchronized void start() {
try {
getConfig().setBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, true);
getConfig().set(YarnConfiguration.RM_ADDRESS,
MiniYARNCluster.getHostname() + ":0");
if (!getConfig().getBoolean(
YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS,
YarnConfiguration.DEFAULT_YARN_MINICLUSTER_FIXED_PORTS)) {
// pick free random ports.
getConfig().set(YarnConfiguration.RM_ADDRESS,
MiniYARNCluster.getHostname() + ":0");
getConfig().set(YarnConfiguration.RM_ADMIN_ADDRESS,
@ -147,6 +149,7 @@ public class MiniYARNCluster extends CompositeService {
MiniYARNCluster.getHostname() + ":0");
getConfig().set(YarnConfiguration.RM_WEBAPP_ADDRESS,
MiniYARNCluster.getHostname() + ":0");
}
Store store = StoreFactory.getStore(getConfig());
resourceManager = new ResourceManager(store) {
@Override