Java Code Examples for org.apache.flink.client.cli.CliFrontend#getConfigurationDirectoryFromEnv()
The following examples show how to use
org.apache.flink.client.cli.CliFrontend#getConfigurationDirectoryFromEnv() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlinkYarnSessionCli.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public static void main(final String[] args) { final String configurationDirectory = CliFrontend.getConfigurationDirectoryFromEnv(); final Configuration flinkConfiguration = GlobalConfiguration.loadConfiguration(); int retCode; try { final FlinkYarnSessionCli cli = new FlinkYarnSessionCli( flinkConfiguration, configurationDirectory, "", ""); // no prefix for the YARN session SecurityUtils.install(new SecurityConfiguration(flinkConfiguration)); retCode = SecurityUtils.getInstalledContext().runSecured(() -> cli.run(args)); } catch (CliArgsException e) { retCode = handleCliArgsException(e); } catch (Throwable t) { final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class); retCode = handleError(strippedThrowable); } System.exit(retCode); }
Example 2
Source File: FlinkYarnSessionCli.java From flink with Apache License 2.0 | 6 votes |
public static void main(final String[] args) { final String configurationDirectory = CliFrontend.getConfigurationDirectoryFromEnv(); final Configuration flinkConfiguration = GlobalConfiguration.loadConfiguration(); int retCode; try { final FlinkYarnSessionCli cli = new FlinkYarnSessionCli( flinkConfiguration, configurationDirectory, "", ""); // no prefix for the YARN session SecurityUtils.install(new SecurityConfiguration(flinkConfiguration)); retCode = SecurityUtils.getInstalledContext().runSecured(() -> cli.run(args)); } catch (CliArgsException e) { retCode = handleCliArgsException(e); } catch (Throwable t) { final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class); retCode = handleError(strippedThrowable); } System.exit(retCode); }
Example 3
Source File: FlinkYarnSessionCli.java From flink with Apache License 2.0 | 6 votes |
public static void main(final String[] args) { final String configurationDirectory = CliFrontend.getConfigurationDirectoryFromEnv(); final Configuration flinkConfiguration = GlobalConfiguration.loadConfiguration(); int retCode; try { final FlinkYarnSessionCli cli = new FlinkYarnSessionCli( flinkConfiguration, configurationDirectory, "", ""); // no prefix for the YARN session SecurityUtils.install(new SecurityConfiguration(flinkConfiguration)); retCode = SecurityUtils.getInstalledContext().runSecured(() -> cli.run(args)); } catch (CliArgsException e) { retCode = handleCliArgsException(e, LOG); } catch (Throwable t) { final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class); retCode = handleError(strippedThrowable, LOG); } System.exit(retCode); }
Example 4
Source File: YarnTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Nonnull YarnClusterDescriptor createYarnClusterDescriptor(org.apache.flink.configuration.Configuration flinkConfiguration) { final YarnClusterDescriptor yarnClusterDescriptor = new YarnClusterDescriptor( flinkConfiguration, YARN_CONFIGURATION, CliFrontend.getConfigurationDirectoryFromEnv(), yarnClient, true); yarnClusterDescriptor.setLocalJarPath(new Path(flinkUberjar.toURI())); yarnClusterDescriptor.addShipFiles(Collections.singletonList(flinkLibFolder)); return yarnClusterDescriptor; }
Example 5
Source File: YarnTestBase.java From flink with Apache License 2.0 | 5 votes |
@Nonnull YarnClusterDescriptor createYarnClusterDescriptor(org.apache.flink.configuration.Configuration flinkConfiguration) { final YarnClusterDescriptor yarnClusterDescriptor = new YarnClusterDescriptor( flinkConfiguration, YARN_CONFIGURATION, CliFrontend.getConfigurationDirectoryFromEnv(), yarnClient, true); yarnClusterDescriptor.setLocalJarPath(new Path(flinkUberjar.toURI())); yarnClusterDescriptor.addShipFiles(Collections.singletonList(flinkLibFolder)); return yarnClusterDescriptor; }
Example 6
Source File: YarnTestBase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * This method returns once the "startedAfterString" has been seen. */ protected Runner startWithArgs(String[] args, String startedAfterString, RunTypes type) throws IOException { LOG.info("Running with args {}", Arrays.toString(args)); outContent = new ByteArrayOutputStream(); errContent = new ByteArrayOutputStream(); PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(out); PrintStream stdinPrintStream = new PrintStream(out); System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); System.setIn(in); final int startTimeoutSeconds = 60; Runner runner = new Runner( args, flinkConfiguration, CliFrontend.getConfigurationDirectoryFromEnv(), type, 0, stdinPrintStream); runner.setName("Frontend (CLI/YARN Client) runner thread (startWithArgs())."); runner.start(); for (int second = 0; second < startTimeoutSeconds; second++) { sleep(1000); // check output for correct TaskManager startup. if (outContent.toString().contains(startedAfterString) || errContent.toString().contains(startedAfterString)) { LOG.info("Found expected output in redirected streams"); return runner; } // check if thread died if (!runner.isAlive()) { resetStreamsAndSendOutput(); if (runner.getRunnerError() != null) { throw new RuntimeException("Runner failed with exception.", runner.getRunnerError()); } Assert.fail("Runner thread died before the test was finished."); } } resetStreamsAndSendOutput(); Assert.fail("During the timeout period of " + startTimeoutSeconds + " seconds the " + "expected string did not show up"); return null; }
Example 7
Source File: YarnTestBase.java From flink with Apache License 2.0 | 4 votes |
/** * This method returns once the "startedAfterString" has been seen. */ protected Runner startWithArgs(String[] args, String startedAfterString, RunTypes type) throws IOException { LOG.info("Running with args {}", Arrays.toString(args)); outContent = new ByteArrayOutputStream(); errContent = new ByteArrayOutputStream(); PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(out); PrintStream stdinPrintStream = new PrintStream(out); System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); System.setIn(in); final int startTimeoutSeconds = 60; Runner runner = new Runner( args, flinkConfiguration, CliFrontend.getConfigurationDirectoryFromEnv(), type, 0, stdinPrintStream); runner.setName("Frontend (CLI/YARN Client) runner thread (startWithArgs())."); runner.start(); for (int second = 0; second < startTimeoutSeconds; second++) { sleep(1000); // check output for correct TaskManager startup. if (outContent.toString().contains(startedAfterString) || errContent.toString().contains(startedAfterString)) { LOG.info("Found expected output in redirected streams"); return runner; } // check if thread died if (!runner.isAlive()) { resetStreamsAndSendOutput(); if (runner.getRunnerError() != null) { throw new RuntimeException("Runner failed with exception.", runner.getRunnerError()); } Assert.fail("Runner thread died before the test was finished."); } } resetStreamsAndSendOutput(); Assert.fail("During the timeout period of " + startTimeoutSeconds + " seconds the " + "expected string did not show up"); return null; }
Example 8
Source File: YarnTestBase.java From flink with Apache License 2.0 | 4 votes |
/** * This method returns once the "startedAfterString" has been seen. */ protected Runner startWithArgs(String[] args, String startedAfterString, RunTypes type) throws IOException { LOG.info("Running with args {}", Arrays.toString(args)); outContent = new ByteArrayOutputStream(); errContent = new ByteArrayOutputStream(); PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(out); PrintStream stdinPrintStream = new PrintStream(out); System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); System.setIn(in); final int startTimeoutSeconds = 60; Runner runner = new Runner( args, flinkConfiguration, CliFrontend.getConfigurationDirectoryFromEnv(), type, 0, stdinPrintStream); runner.setName("Frontend (CLI/YARN Client) runner thread (startWithArgs())."); runner.start(); for (int second = 0; second < startTimeoutSeconds; second++) { sleep(1000); // check output for correct TaskManager startup. if (outContent.toString().contains(startedAfterString) || errContent.toString().contains(startedAfterString)) { LOG.info("Found expected output in redirected streams"); return runner; } // check if thread died if (!runner.isAlive()) { resetStreamsAndSendOutput(); if (runner.getRunnerError() != null) { throw new RuntimeException("Runner failed with exception.", runner.getRunnerError()); } Assert.fail("Runner thread died before the test was finished."); } } resetStreamsAndSendOutput(); Assert.fail("During the timeout period of " + startTimeoutSeconds + " seconds the " + "expected string did not show up"); return null; }