use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testResumeFromYarnIDZookeeperNamespace.
@Test
public void testResumeFromYarnIDZookeeperNamespace() throws Exception {
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli();
final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(new String[] { "-yid", TEST_YARN_APPLICATION_ID.toString() }, true);
final Configuration executorConfig = flinkYarnSessionCli.toConfiguration(commandLine);
final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(executorConfig);
final YarnClusterDescriptor clusterDescriptor = (YarnClusterDescriptor) clientFactory.createClusterDescriptor(executorConfig);
final Configuration clusterDescriptorConfiguration = clusterDescriptor.getFlinkConfiguration();
String zkNs = clusterDescriptorConfiguration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
assertTrue(zkNs.matches("application_\\d+_0042"));
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testMissingShipFiles.
@Test
public void testMissingShipFiles() throws Exception {
File tmpFile = tmp.newFile();
final String[] args = new String[] { "run", "--yarnship", tmpFile.toString(), "--yarnship", "missing.file" };
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli();
final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(args, false);
try {
flinkYarnSessionCli.toConfiguration(commandLine);
fail("Expected error for missing file");
} catch (ConfigurationException ce) {
assertEquals("Ship file missing.file does not exist", ce.getMessage());
}
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testShipFiles.
@Test
public void testShipFiles() throws Exception {
File tmpFile = tmp.newFile();
final String[] args = new String[] { "run", "--yarnship", tmpFile.toString() };
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli();
final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(args, false);
final Configuration executorConfig = flinkYarnSessionCli.toConfiguration(commandLine);
final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(executorConfig);
YarnClusterDescriptor flinkYarnDescriptor = (YarnClusterDescriptor) clientFactory.createClusterDescriptor(executorConfig);
assertEquals(Lists.newArrayList(tmpFile), flinkYarnDescriptor.getShipFiles());
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testHeapMemoryPropertyWithOldConfigKey.
/**
* Tests the specifying heap memory with old config key for job manager and task manager.
*/
@Test
public void testHeapMemoryPropertyWithOldConfigKey() throws Exception {
Configuration configuration = new Configuration();
configuration.setInteger(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB, 2048);
configuration.setInteger(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB, 4096);
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli(configuration);
final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(new String[0], false);
configuration.addAll(flinkYarnSessionCli.toConfiguration(commandLine));
final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(configuration);
final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(configuration);
assertThat(clusterSpecification.getMasterMemoryMB(), is(2048));
assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(4096));
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testCorrectSettingOfMaxSlots.
@Test
public void testCorrectSettingOfMaxSlots() throws Exception {
String[] params = new String[] { "-ys", "3" };
final Configuration configuration = createConfigurationWithJmAndTmTotalMemory(2048);
final FlinkYarnSessionCli yarnCLI = createFlinkYarnSessionCli(configuration);
final CommandLine commandLine = yarnCLI.parseCommandLineOptions(params, true);
configuration.addAll(yarnCLI.toConfiguration(commandLine));
final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(configuration);
final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(configuration);
// each task manager has 3 slots but the parallelism is 7. Thus the slots should be
// increased.
assertEquals(3, clusterSpecification.getSlotsPerTaskManager());
}
Aggregations