Search in sources :

Example 16 with RunOptions

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

the class CliFrontendPackageProgramTest method testVariantWithExplicitJarAndArgumentsOption.

@Test
public void testVariantWithExplicitJarAndArgumentsOption() {
    try {
        String[] arguments = { "--classpath", "file:///tmp/foo", "--classpath", "file:///tmp/bar", "-j", getTestJarPath(), "-a", "--debug", "true", "arg1", "arg2" };
        URL[] classpath = new URL[] { new URL("file:///tmp/foo"), new URL("file:///tmp/bar") };
        String[] reducedArguments = new String[] { "--debug", "true", "arg1", "arg2" };
        RunOptions options = CliFrontendParser.parseRunCommand(arguments);
        assertEquals(getTestJarPath(), options.getJarFilePath());
        assertArrayEquals(classpath, options.getClasspaths().toArray());
        assertArrayEquals(reducedArguments, options.getProgramArgs());
        CliFrontend frontend = new CliFrontend(CliFrontendTestUtils.getConfigDir());
        PackagedProgram prog = frontend.buildProgram(options);
        Assert.assertArrayEquals(reducedArguments, prog.getArguments());
        Assert.assertEquals(TEST_JAR_MAIN_CLASS, prog.getMainClassName());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : PackagedProgram(org.apache.flink.client.program.PackagedProgram) URL(java.net.URL) RunOptions(org.apache.flink.client.cli.RunOptions) ProgramInvocationException(org.apache.flink.client.program.ProgramInvocationException) FileNotFoundException(java.io.FileNotFoundException) CompilerException(org.apache.flink.optimizer.CompilerException) Test(org.junit.Test)

Example 17 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnPropertiesFileWithFinishedApplication.

@Test(expected = IllegalConfigurationException.class)
public void testResumeFromYarnPropertiesFileWithFinishedApplication() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath(), FinalApplicationStatus.SUCCEEDED);
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] {});
    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 18 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnID.

@Test
public void testResumeFromYarnID() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath());
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] { "-yid", TEST_YARN_APPLICATION_ID.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 19 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnIDWithFinishedApplication.

@Test(expected = IllegalConfigurationException.class)
public void testResumeFromYarnIDWithFinishedApplication() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath(), FinalApplicationStatus.SUCCEEDED);
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] { "-yid", TEST_YARN_APPLICATION_ID.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 20 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnIDZookeeperNamespaceOverride.

@Test
public void testResumeFromYarnIDZookeeperNamespaceOverride() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath());
    String overrideZkNamespace = "my_cluster";
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] { "-yid", TEST_YARN_APPLICATION_ID.toString(), "-yz", overrideZkNamespace });
    frontend.retrieveClient(options);
    String zkNs = frontend.getConfiguration().getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
    Assert.assertEquals(overrideZkNamespace, zkNs);
}
Also used : File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) 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