final RunOptions runOptions = new RunOptions(commandLine); if (runOptions.isPrintHelp()) { CliFrontendParser.printHelpForRun(customCommandLines); return; if (runOptions.getJarFilePath() == null) { throw new CliArgsException("The program JAR file was not specified.");
if (clusterId == null && runOptions.getDetachedMode()) { int parallelism = runOptions.getParallelism() == -1 ? defaultParallelism : runOptions.getParallelism(); clusterSpecification, jobGraph, runOptions.getDetachedMode()); if (!runOptions.getDetachedMode() && runOptions.isShutdownOnAttachedExit()) { shutdownHook = ShutdownHookUtil.addShutdownHook(client::shutDownCluster, client.getClass().getSimpleName(), LOG); } else { client.setPrintStatusDuringExecution(runOptions.getStdoutLogging()); client.setDetached(runOptions.getDetachedMode()); LOG.debug("Client slots is set to {}", client.getMaxSlots()); LOG.debug("{}", runOptions.getSavepointRestoreSettings()); int userParallelism = runOptions.getParallelism(); LOG.debug("User parallelism is set to {}", userParallelism); if (client.getMaxSlots() != MAX_SLOTS_UNKNOWN && userParallelism == -1) {
@Test public void testNonExistingFileWithoutArguments() throws Exception { String[] arguments = {"/some/none/existing/path"}; RunOptions options = CliFrontendParser.parseRunCommand(arguments); assertEquals(arguments[0], options.getJarFilePath()); assertArrayEquals(new String[0], options.getProgramArgs()); try { frontend.buildProgram(options); } catch (FileNotFoundException e) { // that's what we want } }
if (options.isPrintHelp()) { CliFrontendParser.printHelpForRun(); return 0; if (options.getJarFilePath() == null) { return handleArgException(new CliArgsException("The program JAR file was not specified.")); client.setPrintStatusDuringExecution(options.getStdoutLogging()); client.setDetached(options.getDetachedMode()); LOG.debug("Client slots is set to {}", client.getMaxSlots()); LOG.debug(options.getSavepointRestoreSettings().toString()); int userParallelism = options.getParallelism(); LOG.debug("User parallelism is set to {}", userParallelism); if (client.getMaxSlots() != -1 && userParallelism == -1) {
@Test public void testNonExistingFileWithArguments() throws Exception { String[] arguments = { "--classpath", "file:///tmp/foo", "--classpath", "file:///tmp/bar", "/some/none/existing/path", "--debug", "true", "arg1", "arg2" }; URL[] classpath = new URL[] { new URL("file:///tmp/foo"), new URL("file:///tmp/bar") }; String[] reducedArguments = {"--debug", "true", "arg1", "arg2"}; RunOptions options = CliFrontendParser.parseRunCommand(arguments); assertEquals(arguments[4], options.getJarFilePath()); assertArrayEquals(classpath, options.getClasspaths().toArray()); assertArrayEquals(reducedArguments, options.getProgramArgs()); try { frontend.buildProgram(options); fail("Should fail with an exception"); } catch (FileNotFoundException e) { // that's what we want } }
private static RunOptions createRunOptions(CommandLine commandLine) { try { return new RunOptions(commandLine); } catch (CliArgsException e) { throw new SqlExecutionException("Invalid deployment run options.", e); } }
assertEquals(getTestJarPath(), options.getJarFilePath()); assertArrayEquals(classpath, options.getClasspaths().toArray()); assertEquals(TEST_JAR_CLASSLOADERTEST_CLASS, options.getEntryPointClassName()); assertArrayEquals(reducedArguments, options.getProgramArgs());
SavepointRestoreSettings savepointSettings = options.getSavepointRestoreSettings(); assertTrue(savepointSettings.restoreSavepoint()); assertEquals("expectedSavepointPath", savepointSettings.getRestorePath()); SavepointRestoreSettings savepointSettings = options.getSavepointRestoreSettings(); assertTrue(savepointSettings.restoreSavepoint()); assertEquals("expectedSavepointPath", savepointSettings.getRestorePath()); { getTestJarPath(), "-arg1", "value1", "justavalue", "--arg2", "value2"}; RunOptions options = CliFrontendParser.parseRunCommand(parameters); assertEquals("-arg1", options.getProgramArgs()[0]); assertEquals("value1", options.getProgramArgs()[1]); assertEquals("justavalue", options.getProgramArgs()[2]); assertEquals("--arg2", options.getProgramArgs()[3]); assertEquals("value2", options.getProgramArgs()[4]);
@Test public void testVariantWithExplicitJarAndArgumentsOption() throws Exception { 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()); PackagedProgram prog = frontend.buildProgram(options); Assert.assertArrayEquals(reducedArguments, prog.getArguments()); Assert.assertEquals(TEST_JAR_MAIN_CLASS, prog.getMainClassName()); }
public static RunOptions parseRunCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(RUN_OPTIONS, args, true); return new RunOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }
if (clusterId == null && runOptions.getDetachedMode()) { int parallelism = runOptions.getParallelism() == -1 ? defaultParallelism : runOptions.getParallelism(); clusterSpecification, jobGraph, runOptions.getDetachedMode()); if (!runOptions.getDetachedMode() && runOptions.isShutdownOnAttachedExit()) { shutdownHook = ShutdownHookUtil.addShutdownHook(client::shutDownCluster, client.getClass().getSimpleName(), LOG); } else { client.setPrintStatusDuringExecution(runOptions.getStdoutLogging()); client.setDetached(runOptions.getDetachedMode()); LOG.debug("Client slots is set to {}", client.getMaxSlots()); LOG.debug("{}", runOptions.getSavepointRestoreSettings()); int userParallelism = runOptions.getParallelism(); LOG.debug("User parallelism is set to {}", userParallelism); if (client.getMaxSlots() != MAX_SLOTS_UNKNOWN && userParallelism == -1) {
final RunOptions runOptions = new RunOptions(commandLine); if (runOptions.isPrintHelp()) { CliFrontendParser.printHelpForRun(customCommandLines); return; if (runOptions.getJarFilePath() == null) { throw new CliArgsException("The program JAR file was not specified.");
@Test public void testVariantWithExplicitJarAndNoArgumentsOption() throws Exception { String[] arguments = { "--classpath", "file:///tmp/foo", "--classpath", "file:///tmp/bar", "-j", getTestJarPath(), "--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()); PackagedProgram prog = frontend.buildProgram(options); Assert.assertArrayEquals(reducedArguments, prog.getArguments()); Assert.assertEquals(TEST_JAR_MAIN_CLASS, prog.getMainClassName()); }
public static RunOptions parseRunCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(RUN_OPTIONS, args, true); return new RunOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }
if (isNewMode && clusterId == null && runOptions.getDetachedMode()) { int parallelism = runOptions.getParallelism() == -1 ? defaultParallelism : runOptions.getParallelism(); clusterSpecification, jobGraph, runOptions.getDetachedMode()); client.setPrintStatusDuringExecution(runOptions.getStdoutLogging()); client.setDetached(runOptions.getDetachedMode()); LOG.debug("Client slots is set to {}", client.getMaxSlots()); LOG.debug("{}", runOptions.getSavepointRestoreSettings()); int userParallelism = runOptions.getParallelism(); LOG.debug("User parallelism is set to {}", userParallelism); if (client.getMaxSlots() != MAX_SLOTS_UNKNOWN && userParallelism == -1) {
final RunOptions runOptions = new RunOptions(commandLine); if (runOptions.isPrintHelp()) { CliFrontendParser.printHelpForRun(customCommandLines); return; if (runOptions.getJarFilePath() == null) { throw new CliArgsException("The program JAR file was not specified.");
@Test public void testValidVariantWithNoJarAndNoArgumentsOption() throws Exception { String[] arguments = { "--classpath", "file:///tmp/foo", "--classpath", "file:///tmp/bar", getTestJarPath(), "--debug", "true", "arg1", "arg2" }; URL[] classpath = new URL[] { new URL("file:///tmp/foo"), new URL("file:///tmp/bar") }; String[] reducedArguments = {"--debug", "true", "arg1", "arg2"}; RunOptions options = CliFrontendParser.parseRunCommand(arguments); assertEquals(getTestJarPath(), options.getJarFilePath()); assertArrayEquals(classpath, options.getClasspaths().toArray()); assertArrayEquals(reducedArguments, options.getProgramArgs()); PackagedProgram prog = frontend.buildProgram(options); Assert.assertArrayEquals(reducedArguments, prog.getArguments()); Assert.assertEquals(TEST_JAR_MAIN_CLASS, prog.getMainClassName()); }
public static RunOptions parseRunCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(RUN_OPTIONS, args, true); return new RunOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }
public static RunOptions parseRunCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(RUN_OPTIONS, args, true); return new RunOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }