Search in sources :

Example 21 with RunOptions

use of org.apache.flink.client.cli.RunOptions in project flink by apache.

the class CliFrontendYarnAddressConfigurationTest method testResumeFromInvalidYarnID.

@Test(expected = IllegalConfigurationException.class)
public void testResumeFromInvalidYarnID() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath(), FinalApplicationStatus.SUCCEEDED);
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] { "-yid", ApplicationId.newInstance(0, 666).toString() });
    frontend.retrieveClient(options);
    checkJobManagerAddress(frontend.getConfiguration(), TEST_YARN_JOB_MANAGER_ADDRESS, TEST_YARN_JOB_MANAGER_PORT);
}
Also used : File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) Test(org.junit.Test)

Example 22 with RunOptions

use of org.apache.flink.client.cli.RunOptions in project flink by apache.

the class FlinkYarnSessionCliTest method testZookeeperNamespaceProperty.

@Test
public void testZookeeperNamespaceProperty() throws Exception {
    File confFile = tmp.newFile("flink-conf.yaml");
    File jarFile = tmp.newFile("test.jar");
    new CliFrontend(tmp.getRoot().getAbsolutePath());
    String zkNamespaceCliInput = "flink_test_namespace";
    String[] params = new String[] { "-yn", "2", "-yz", zkNamespaceCliInput, jarFile.getAbsolutePath() };
    RunOptions runOptions = CliFrontendParser.parseRunCommand(params);
    FlinkYarnSessionCli yarnCLI = new TestCLI("y", "yarn");
    AbstractYarnClusterDescriptor descriptor = yarnCLI.createDescriptor("", runOptions.getCommandLine());
    Assert.assertEquals(zkNamespaceCliInput, descriptor.getZookeeperNamespace());
}
Also used : CliFrontend(org.apache.flink.client.CliFrontend) File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Example 23 with RunOptions

use of org.apache.flink.client.cli.RunOptions in project flink by apache.

the class FlinkYarnSessionCliTest method testNotEnoughTaskSlots.

@Test
public void testNotEnoughTaskSlots() throws Exception {
    File confFile = tmp.newFile("flink-conf.yaml");
    File jarFile = tmp.newFile("test.jar");
    new CliFrontend(tmp.getRoot().getAbsolutePath());
    String[] params = new String[] { "-yn", "2", "-ys", "3", "-p", "7", jarFile.getAbsolutePath() };
    RunOptions runOptions = CliFrontendParser.parseRunCommand(params);
    FlinkYarnSessionCli yarnCLI = new TestCLI("y", "yarn");
    AbstractYarnClusterDescriptor descriptor = yarnCLI.createDescriptor("", runOptions.getCommandLine());
    // each task manager has 3 slots but the parallelism is 7. Thus the slots should be increased.
    Assert.assertEquals(4, descriptor.getTaskManagerSlots());
    Assert.assertEquals(2, descriptor.getTaskManagerCount());
}
Also used : CliFrontend(org.apache.flink.client.CliFrontend) File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Aggregations

RunOptions (org.apache.flink.client.cli.RunOptions)23 Test (org.junit.Test)22 File (java.io.File)13 FileNotFoundException (java.io.FileNotFoundException)7 ProgramInvocationException (org.apache.flink.client.program.ProgramInvocationException)6 CompilerException (org.apache.flink.optimizer.CompilerException)6 URL (java.net.URL)5 PackagedProgram (org.apache.flink.client.program.PackagedProgram)5 Configuration (org.apache.flink.configuration.Configuration)5 ClusterClient (org.apache.flink.client.program.ClusterClient)4 InetSocketAddress (java.net.InetSocketAddress)3 CliFrontend (org.apache.flink.client.CliFrontend)3 FlinkYarnSessionCli (org.apache.flink.yarn.cli.FlinkYarnSessionCli)3 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)2 CliArgsException (org.apache.flink.client.cli.CliArgsException)1 DataStatistics (org.apache.flink.optimizer.DataStatistics)1 Optimizer (org.apache.flink.optimizer.Optimizer)1 DefaultCostEstimator (org.apache.flink.optimizer.costs.DefaultCostEstimator)1 CancelJobWithSavepoint (org.apache.flink.runtime.messages.JobManagerMessages.CancelJobWithSavepoint)1 DisposeSavepoint (org.apache.flink.runtime.messages.JobManagerMessages.DisposeSavepoint)1