Search in sources :

Example 1 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnPropertiesFile.

/**
	 * Test that the CliFrontend is able to pick up the .yarn-properties file from a specified location.
	 */
@Test
public void testResumeFromYarnPropertiesFile() throws Exception {
    File directoryPath = writeYarnPropertiesFile(validPropertiesFile);
    // start CLI Frontend
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath());
    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 2 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testManualOptionsOverridesYarn.

@Test
public void testManualOptionsOverridesYarn() throws Exception {
    File emptyFolder = temporaryFolder.newFolder();
    File testConfFile = new File(emptyFolder.getAbsolutePath(), "flink-conf.yaml");
    Files.createFile(testConfFile.toPath());
    TestCLI frontend = new TestCLI(emptyFolder.getAbsolutePath());
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] { "-m", "10.221.130.22:7788" });
    frontend.retrieveClient(options);
    Configuration config = frontend.getConfiguration();
    InetSocketAddress expectedAddress = InetSocketAddress.createUnresolved("10.221.130.22", 7788);
    checkJobManagerAddress(config, expectedAddress.getHostName(), expectedAddress.getPort());
}
Also used : Configuration(org.apache.flink.configuration.Configuration) InetSocketAddress(java.net.InetSocketAddress) File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) Test(org.junit.Test)

Example 3 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testResumeFromYarnIDZookeeperNamespace.

@Test
public void testResumeFromYarnIDZookeeperNamespace() 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);
    String zkNs = frontend.getConfiguration().getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
    Assert.assertTrue(zkNs.matches("application_\\d+_0042"));
}
Also used : File(java.io.File) RunOptions(org.apache.flink.client.cli.RunOptions) Test(org.junit.Test)

Example 4 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testYarnIDOverridesPropertiesFile.

@Test
public void testYarnIDOverridesPropertiesFile() throws Exception {
    File directoryPath = writeYarnPropertiesFile(invalidPropertiesFile);
    // 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 5 with RunOptions

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

the class CliFrontendYarnAddressConfigurationTest method testInvalidYarnPropertiesFile.

@Test(expected = IllegalConfigurationException.class)
public void testInvalidYarnPropertiesFile() throws Exception {
    File directoryPath = writeYarnPropertiesFile(invalidPropertiesFile);
    TestCLI frontend = new CustomYarnTestCLI(directoryPath.getAbsolutePath());
    RunOptions options = CliFrontendParser.parseRunCommand(new String[] {});
    frontend.retrieveClient(options);
    Configuration config = frontend.getConfiguration();
    checkJobManagerAddress(config, TEST_JOB_MANAGER_ADDRESS, TEST_JOB_MANAGER_PORT);
}
Also used : Configuration(org.apache.flink.configuration.Configuration) 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