From 4cc34c9cddd0feade87eb2e32a99a1c3a2a7d33d Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Fri, 9 Sep 2011 19:01:39 +0000 Subject: [PATCH] Merge -r 1167330:1167331 from trunk to branch-0.23 to fix MAPREDUCE-2975. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1167332 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/mapred/YARNRunner.java | 10 +++++----- .../hadoop/mapred/YarnClientProtocolProvider.java | 3 ++- .../org/apache/hadoop/mapreduce/v2/TestYARNRunner.java | 5 +++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index a2a61272b29..1f6c6684340 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1246,6 +1246,9 @@ Release 0.23.0 - Unreleased MAPREDUCE-2954. Fixed a deadlock in NM caused due to wrong synchronization in protocol buffer records. (Siddharth Seth via vinodkv) + MAPREDUCE-2975. Fixed YARNRunner to use YarnConfiguration rather than + Configuration. (mahadev via acmurthy) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java index 3b63a69c2be..dc65659966d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java @@ -101,18 +101,18 @@ public class YARNRunner implements ClientProtocol { * yarn * @param conf the configuration object for the client */ - public YARNRunner(Configuration conf) { - this(conf, new ResourceMgrDelegate(conf)); + public YARNRunner(YarnConfiguration conf) { + this(conf, new ResourceMgrDelegate(conf)); } /** - * Similar to {@link #YARNRunner(Configuration)} but allowing injecting + * Similar to {@link #YARNRunner(YarnConfiguration)} but allowing injecting * {@link ResourceMgrDelegate}. Enables mocking and testing. * @param conf the configuration object for the client * @param resMgrDelegate the resourcemanager client handle. */ - public YARNRunner(Configuration conf, ResourceMgrDelegate resMgrDelegate) { - this.conf = new YarnConfiguration(conf); + public YARNRunner(YarnConfiguration conf, ResourceMgrDelegate resMgrDelegate) { + this.conf = conf; try { this.resMgrDelegate = resMgrDelegate; this.clientCache = new ClientCache(this.conf, diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YarnClientProtocolProvider.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YarnClientProtocolProvider.java index 431b49fb202..74bd303d068 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YarnClientProtocolProvider.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YarnClientProtocolProvider.java @@ -25,13 +25,14 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.MRConfig; import org.apache.hadoop.mapreduce.protocol.ClientProtocol; import org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider; +import org.apache.hadoop.yarn.conf.YarnConfiguration; public class YarnClientProtocolProvider extends ClientProtocolProvider { @Override public ClientProtocol create(Configuration conf) throws IOException { if ("yarn".equals(conf.get(MRConfig.FRAMEWORK_NAME))) { - return new YARNRunner(conf); + return new YARNRunner(new YarnConfiguration(conf)); } return null; } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestYARNRunner.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestYARNRunner.java index 5a2c29afc58..bc0dfe5fa4a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestYARNRunner.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestYARNRunner.java @@ -45,6 +45,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationState; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; +import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.junit.Before; @@ -63,7 +64,7 @@ public class TestYARNRunner extends TestCase { private YARNRunner yarnRunner; private ResourceMgrDelegate resourceMgrDelegate; - private Configuration conf; + private YarnConfiguration conf; private ApplicationId appId; private JobID jobId; private File testWorkDir = @@ -74,7 +75,7 @@ public class TestYARNRunner extends TestCase { @Before public void setUp() throws Exception { resourceMgrDelegate = mock(ResourceMgrDelegate.class); - conf = new Configuration(); + conf = new YarnConfiguration(); yarnRunner = new YARNRunner(conf, resourceMgrDelegate); yarnRunner = spy(yarnRunner); submissionContext = mock(ApplicationSubmissionContext.class);