use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testJobManagerMemoryPropertyWithConfigDefaultValue.
/**
* Tests the specifying job manager total process memory with config default value for job
* manager and task manager.
*/
@Test
public void testJobManagerMemoryPropertyWithConfigDefaultValue() throws Exception {
int procMemory = 2048;
final Configuration configuration = createConfigurationWithJmAndTmTotalMemory(procMemory);
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(procMemory));
assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(procMemory));
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testYarnIDOverridesPropertiesFile.
@Test
public void testYarnIDOverridesPropertiesFile() throws Exception {
File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
final Configuration configuration = new Configuration();
configuration.setString(YarnConfigOptions.PROPERTIES_FILE_LOCATION, directoryPath.getAbsolutePath());
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli(configuration);
final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(new String[] { "-yid", TEST_YARN_APPLICATION_ID_2.toString() }, true);
final Configuration executorConfig = flinkYarnSessionCli.toConfiguration(commandLine);
final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(executorConfig);
final ApplicationId clusterId = clientFactory.getClusterId(executorConfig);
assertEquals(TEST_YARN_APPLICATION_ID_2, clusterId);
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testMultipleYarnShipOptions.
@Test
public void testMultipleYarnShipOptions() throws Exception {
final String[] args = new String[] { "run", "--yarnship", tmp.newFolder().getAbsolutePath(), "--yarnship", tmp.newFolder().getAbsolutePath() };
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(2, flinkYarnDescriptor.getShipFiles().size());
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method validateYarnCLIisActive.
private void validateYarnCLIisActive(Configuration configuration) throws FlinkException, CliArgsException {
final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli(configuration);
final CommandLine testCLIArgs = flinkYarnSessionCli.parseCommandLineOptions(new String[] {}, true);
assertTrue(flinkYarnSessionCli.isActive(testCLIArgs));
}
use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.
the class FlinkYarnSessionCliTest method testDynamicProperties.
@Test
public void testDynamicProperties() throws Exception {
FlinkYarnSessionCli cli = new FlinkYarnSessionCli(new Configuration(), tmp.getRoot().getAbsolutePath(), "", "", false);
Options options = new Options();
cli.addGeneralOptions(options);
cli.addRunOptions(options);
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(options, new String[] { "run", "-j", "fake.jar", "-D", AkkaOptions.ASK_TIMEOUT_DURATION.key() + "=5 min", "-D", CoreOptions.FLINK_JVM_OPTIONS.key() + "=-DappName=foobar", "-D", SecurityOptions.SSL_INTERNAL_KEY_PASSWORD.key() + "=changeit" });
Configuration executorConfig = cli.toConfiguration(cmd);
assertEquals(Duration.ofMinutes(5), executorConfig.get(AkkaOptions.ASK_TIMEOUT_DURATION));
assertEquals("-DappName=foobar", executorConfig.get(CoreOptions.FLINK_JVM_OPTIONS));
assertEquals("changeit", executorConfig.get(SecurityOptions.SSL_INTERNAL_KEY_PASSWORD));
}
Aggregations