Search in sources :

Example 21 with FlinkYarnSessionCli

use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.

the class FlinkYarnSessionCliTest method testResumeFromYarnID.

@Test
public void testResumeFromYarnID() 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 ApplicationId clusterId = clientFactory.getClusterId(executorConfig);
    assertEquals(TEST_YARN_APPLICATION_ID, clusterId);
}
Also used : CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) CommandLine(org.apache.commons.cli.CommandLine) Configuration(org.apache.flink.configuration.Configuration) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Example 22 with FlinkYarnSessionCli

use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.

the class FlinkYarnSessionCliTest method testZookeeperNamespaceProperty.

@Test
public void testZookeeperNamespaceProperty() throws Exception {
    String zkNamespaceCliInput = "flink_test_namespace";
    String[] params = new String[] { "-yz", zkNamespaceCliInput };
    FlinkYarnSessionCli yarnCLI = createFlinkYarnSessionCli();
    CommandLine commandLine = yarnCLI.parseCommandLineOptions(params, true);
    Configuration executorConfig = yarnCLI.toConfiguration(commandLine);
    assertThat(executorConfig.get(HighAvailabilityOptions.HA_CLUSTER_ID), is(zkNamespaceCliInput));
}
Also used : CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) CommandLine(org.apache.commons.cli.CommandLine) Configuration(org.apache.flink.configuration.Configuration) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Example 23 with FlinkYarnSessionCli

use of org.apache.flink.yarn.cli.FlinkYarnSessionCli in project flink by apache.

the class FlinkYarnSessionCliTest method testResumeFromYarnIDZookeeperNamespaceOverride.

@Test
public void testResumeFromYarnIDZookeeperNamespaceOverride() throws Exception {
    final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli();
    final String overrideZkNamespace = "my_cluster";
    final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(new String[] { "-yid", TEST_YARN_APPLICATION_ID.toString(), "-yz", overrideZkNamespace }, 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();
    final String clusterId = clusterDescriptorConfiguration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
    assertEquals(overrideZkNamespace, clusterId);
}
Also used : CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) CommandLine(org.apache.commons.cli.CommandLine) Configuration(org.apache.flink.configuration.Configuration) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Aggregations

FlinkYarnSessionCli (org.apache.flink.yarn.cli.FlinkYarnSessionCli)23 Test (org.junit.Test)22 CommandLine (org.apache.commons.cli.CommandLine)21 CustomCommandLine (org.apache.flink.client.cli.CustomCommandLine)21 Configuration (org.apache.flink.configuration.Configuration)20 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)16 ClusterSpecification (org.apache.flink.client.deployment.ClusterSpecification)8 File (java.io.File)5 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 DefaultParser (org.apache.commons.cli.DefaultParser)1 Options (org.apache.commons.cli.Options)1 CliFrontend (org.apache.flink.client.CliFrontend)1 RunOptions (org.apache.flink.client.cli.RunOptions)1 ClusterClientServiceLoader (org.apache.flink.client.deployment.ClusterClientServiceLoader)1 DefaultClusterClientServiceLoader (org.apache.flink.client.deployment.DefaultClusterClientServiceLoader)1 AkkaOptions (org.apache.flink.configuration.AkkaOptions)1 CoreOptions (org.apache.flink.configuration.CoreOptions)1 DeploymentOptions (org.apache.flink.configuration.DeploymentOptions)1 HighAvailabilityOptions (org.apache.flink.configuration.HighAvailabilityOptions)1 JobManagerOptions (org.apache.flink.configuration.JobManagerOptions)1