MAPREDUCE-2975. Fixed YARNRunner to use YarnConfiguration rather than Configuration. Contributed by Mahadev Konar.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1167331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2011-09-09 19:01:08 +00:00
parent 68cb2b01b6
commit fbf0035ee6
4 changed files with 13 additions and 8 deletions

View File

@ -1263,6 +1263,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

View File

@ -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,

View File

@ -25,13 +25,14 @@
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;
}

View File

@ -45,6 +45,7 @@
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);