From 04ad500fac14ac69c6c12b47109716a6b5e4a0fe Mon Sep 17 00:00:00 2001 From: Tsuyoshi Ozawa Date: Wed, 28 Jan 2015 00:15:34 +0900 Subject: [PATCH] YARN-3086. Make NodeManager memory configurable in MiniYARNCluster. Contributed by Robert Metzger. (cherry picked from commit f56da3ce040b16582ce8153df0d7cea00becd843) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/yarn/conf/YarnConfiguration.java | 5 +++++ .../java/org/apache/hadoop/yarn/server/MiniYARNCluster.java | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 8fc1d2370c0..974b4aaa775 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -172,6 +172,9 @@ Release 2.7.0 - UNRELEASED YARN-3092. Created a common ResourceUsage class to track labeled resource usages in Capacity Scheduler. (Wangda Tan via jianhe) + YARN-3086. Make NodeManager memory configurable in MiniYARNCluster. + (Robert Metzger via ozawa) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 32142d9e135..ebbc12d439a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -1205,6 +1205,11 @@ public class YarnConfiguration extends Configuration { public static final boolean DEFAULT_YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING = false; + /** Allow changing the memory for the NodeManager in the MiniYARNCluster */ + public static final String YARN_MINICLUSTER_NM_PMEM_MB = + YARN_MC_PREFIX + YarnConfiguration.NM_PMEM_MB; + public static final int DEFAULT_YARN_MINICLUSTER_NM_PMEM_MB = 4 * 1024; + /** The log directory for the containers */ public static final String YARN_APP_CONTAINER_LOG_DIR = YARN_PREFIX + "app.container.log.dir"; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java index 4bdf33a69df..365e0bb66b1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java @@ -508,8 +508,10 @@ public class MiniYARNCluster extends CompositeService { String logDirsString = prepareDirs("log", numLogDirs); config.set(YarnConfiguration.NM_LOG_DIRS, logDirsString); - // By default AM + 2 containers - config.setInt(YarnConfiguration.NM_PMEM_MB, 4*1024); + config.setInt(YarnConfiguration.NM_PMEM_MB, config.getInt( + YarnConfiguration.YARN_MINICLUSTER_NM_PMEM_MB, + YarnConfiguration.DEFAULT_YARN_MINICLUSTER_NM_PMEM_MB)); + config.set(YarnConfiguration.NM_ADDRESS, MiniYARNCluster.getHostname() + ":0"); config.set(YarnConfiguration.NM_LOCALIZER_ADDRESS,