From bf876f70fba1fbc61f4062255981684b992a56b6 Mon Sep 17 00:00:00 2001 From: Bikas Saha Date: Tue, 16 Jul 2013 22:51:12 +0000 Subject: [PATCH] MAPREDUCE-5398. MR changes for YARN-513 (Jian He via bikas) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1503934 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 2 ++ .../mapreduce/v2/app/rm/RMCommunicator.java | 21 ++---------------- .../hadoop/mapred/ResourceMgrDelegate.java | 22 ++----------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index bb634cd49a..3ba99d838e 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -344,6 +344,8 @@ Release 2.1.0-beta - 2013-07-02 MAPREDUCE-5333. Add test that verifies MRAM works correctly when sending requests with non-normalized capabilities. (ywskycn via tucu) + MAPREDUCE-5398. MR changes for YARN-513 (Jian He via bikas) + OPTIMIZATIONS MAPREDUCE-4974. Optimising the LineRecordReader initialize() method diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java index fb2cca31bd..ca64cc8312 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; -import java.security.PrivilegedAction; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicBoolean; @@ -50,12 +49,11 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.Resource; -import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.yarn.client.ClientRMProxy; import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; -import org.apache.hadoop.yarn.ipc.YarnRPC; /** * Registers/unregisters to RM and sends heartbeats to RM. @@ -265,27 +263,12 @@ public void run() { protected ApplicationMasterProtocol createSchedulerProxy() { final Configuration conf = getConfig(); - final YarnRPC rpc = YarnRPC.create(conf); - final InetSocketAddress serviceAddr = conf.getSocketAddr( - YarnConfiguration.RM_SCHEDULER_ADDRESS, - YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS, - YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT); - UserGroupInformation currentUser; try { - currentUser = UserGroupInformation.getCurrentUser(); + return ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class); } catch (IOException e) { throw new YarnRuntimeException(e); } - - // CurrentUser should already have AMToken loaded. - return currentUser.doAs(new PrivilegedAction() { - @Override - public ApplicationMasterProtocol run() { - return (ApplicationMasterProtocol) rpc.getProxy(ApplicationMasterProtocol.class, - serviceAddr, conf); - } - }); } protected abstract void heartbeat() throws Exception; diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java index 45242629fd..efdd4fb6b4 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java @@ -75,36 +75,18 @@ public class ResourceMgrDelegate extends YarnClient { * @param conf the configuration object. */ public ResourceMgrDelegate(YarnConfiguration conf) { - this(conf, null); - } - - /** - * Delegate responsible for communicating with the Resource Manager's - * {@link ApplicationClientProtocol}. - * @param conf the configuration object. - * @param rmAddress the address of the Resource Manager - */ - public ResourceMgrDelegate(YarnConfiguration conf, - InetSocketAddress rmAddress) { super(ResourceMgrDelegate.class.getName()); this.conf = conf; - this.rmAddress = rmAddress; - if (rmAddress == null) { - client = YarnClient.createYarnClient(); - } else { - client = YarnClient.createYarnClient(rmAddress); - } + this.client = YarnClient.createYarnClient(); init(conf); start(); } @Override protected void serviceInit(Configuration conf) throws Exception { - if (rmAddress == null) { - this.rmAddress = conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, + this.rmAddress = conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); - } client.init(conf); super.serviceInit(conf); }