Search in sources :

Example 1 with LocalJobRunner

use of org.apache.hadoop.mapred.LocalJobRunner in project hadoop by apache.

the class TestClientProtocolProviderImpls method testClusterWithLocalClientProvider.

@Test
public void testClusterWithLocalClientProvider() throws Exception {
    Configuration conf = new Configuration();
    conf.set(MRConfig.FRAMEWORK_NAME, "local");
    Cluster cluster = new Cluster(conf);
    assertTrue(cluster.getClient() instanceof LocalJobRunner);
    cluster.close();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalJobRunner(org.apache.hadoop.mapred.LocalJobRunner) Test(org.junit.Test)

Example 2 with LocalJobRunner

use of org.apache.hadoop.mapred.LocalJobRunner in project hadoop by apache.

the class TestYarnClientProtocolProvider method testClusterWithYarnClientProtocolProvider.

@Test
public void testClusterWithYarnClientProtocolProvider() throws Exception {
    Configuration conf = new Configuration(false);
    Cluster cluster = null;
    try {
        cluster = new Cluster(conf);
    } catch (Exception e) {
        throw new Exception("Failed to initialize a local runner w/o a cluster framework key", e);
    }
    try {
        assertTrue("client is not a LocalJobRunner", cluster.getClient() instanceof LocalJobRunner);
    } finally {
        if (cluster != null) {
            cluster.close();
        }
    }
    try {
        conf = new Configuration();
        conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
        cluster = new Cluster(conf);
        ClientProtocol client = cluster.getClient();
        assertTrue("client is a YARNRunner", client instanceof YARNRunner);
    } catch (IOException e) {
    } finally {
        if (cluster != null) {
            cluster.close();
        }
    }
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YARNRunner(org.apache.hadoop.mapred.YARNRunner) IOException(java.io.IOException) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol) ClientProtocol(org.apache.hadoop.mapreduce.protocol.ClientProtocol) IOException(java.io.IOException) LocalJobRunner(org.apache.hadoop.mapred.LocalJobRunner) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 LocalJobRunner (org.apache.hadoop.mapred.LocalJobRunner)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 YARNRunner (org.apache.hadoop.mapred.YARNRunner)1 ClientProtocol (org.apache.hadoop.mapreduce.protocol.ClientProtocol)1 ApplicationClientProtocol (org.apache.hadoop.yarn.api.ApplicationClientProtocol)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1