Search in sources :

Example 1 with YarnClientParameters

use of com.cloudera.kitten.client.YarnClientParameters in project kitten by cloudera.

the class BasicLuaConfigTest method testBasicClient.

@Test
public void testBasicClient() throws Exception {
    File tmpFile = File.createTempFile("kitten", ".lua");
    Files.copy(newInputStreamSupplier(getResource("lua/test1.lua")), tmpFile);
    tmpFile.deleteOnExit();
    YarnClientParameters params = new LuaYarnClientParameters(tmpFile.getAbsolutePath(), "distshell", conf);
    assertEquals("Distributed Shell", params.getApplicationName());
    assertEquals(86400L, params.getClientTimeoutMillis());
    assertEquals("default", params.getQueue());
    ContainerLaunchParameters clp = params.getApplicationMasterParameters(null);
    assertEquals(1, clp.getPriority());
    // clusterMax = 90 < 100
    assertEquals(clusterMax, clp.getContainerResource(clusterMax));
    Map<String, String> expEnv = ImmutableMap.of("zs", "10", "a", "b", "fiz", "faz", "foo", "foo", "biz", "baz");
    Map<String, String> actEnv = clp.getEnvironment();
    for (Map.Entry<String, String> e : expEnv.entrySet()) {
        assertEquals(e.getValue(), actEnv.get(e.getKey()));
    }
}
Also used : YarnClientParameters(com.cloudera.kitten.client.YarnClientParameters) ContainerLaunchParameters(com.cloudera.kitten.ContainerLaunchParameters) File(java.io.File) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ContainerLaunchParameters (com.cloudera.kitten.ContainerLaunchParameters)1 YarnClientParameters (com.cloudera.kitten.client.YarnClientParameters)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 Map (java.util.Map)1 Test (org.junit.Test)1