@Test public void testChildProcLauncher() throws Exception { // This test is failed on Windows due to the failure of initiating executors // by the path length limitation. See SPARK-18718. assumeTrue(!Utils.isWindows()); SparkSubmitOptionParser opts = new SparkSubmitOptionParser(); Map<String, String> env = new HashMap<>(); env.put("SPARK_PRINT_LAUNCH_COMMAND", "1"); launcher .setMaster("local") .setAppResource(SparkLauncher.NO_RESOURCE) .addSparkArg(opts.CONF, String.format("%s=-Dfoo=ShouldBeOverriddenBelow", SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS)) .setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, "-Dfoo=bar -Dtest.appender=console") .setConf(SparkLauncher.DRIVER_EXTRA_CLASSPATH, System.getProperty("java.class.path")) .addSparkArg(opts.CLASS, "ShouldBeOverriddenBelow") .setMainClass(SparkLauncherTestApp.class.getName()) .redirectError() .addAppArgs("proc"); final Process app = launcher.launch(); new OutputRedirector(app.getInputStream(), getClass().getName() + ".child", TF); assertEquals(0, app.waitFor()); }
@Test public void testChildProcLauncher() throws Exception { // This test is failed on Windows due to the failure of initiating executors // by the path length limitation. See SPARK-18718. assumeTrue(!Utils.isWindows()); SparkSubmitOptionParser opts = new SparkSubmitOptionParser(); Map<String, String> env = new HashMap<>(); env.put("SPARK_PRINT_LAUNCH_COMMAND", "1"); launcher .setMaster("local") .setAppResource(SparkLauncher.NO_RESOURCE) .addSparkArg(opts.CONF, String.format("%s=-Dfoo=ShouldBeOverriddenBelow", SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS)) .setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, "-Dfoo=bar -Dtest.appender=childproc") .setConf(SparkLauncher.DRIVER_EXTRA_CLASSPATH, System.getProperty("java.class.path")) .addSparkArg(opts.CLASS, "ShouldBeOverriddenBelow") .setMainClass(SparkLauncherTestApp.class.getName()) .addAppArgs("proc"); final Process app = launcher.launch(); new OutputRedirector(app.getInputStream(), TF); new OutputRedirector(app.getErrorStream(), TF); assertEquals(0, app.waitFor()); }
@Test public void testChildProcLauncher() throws Exception { // This test is failed on Windows due to the failure of initiating executors // by the path length limitation. See SPARK-18718. assumeTrue(!Utils.isWindows()); SparkSubmitOptionParser opts = new SparkSubmitOptionParser(); Map<String, String> env = new HashMap<>(); env.put("SPARK_PRINT_LAUNCH_COMMAND", "1"); launcher .setMaster("local") .setAppResource(SparkLauncher.NO_RESOURCE) .addSparkArg(opts.CONF, String.format("%s=-Dfoo=ShouldBeOverriddenBelow", SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS)) .setConf(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, "-Dfoo=bar -Dtest.appender=console") .setConf(SparkLauncher.DRIVER_EXTRA_CLASSPATH, System.getProperty("java.class.path")) .addSparkArg(opts.CLASS, "ShouldBeOverriddenBelow") .setMainClass(SparkLauncherTestApp.class.getName()) .redirectError() .addAppArgs("proc"); final Process app = launcher.launch(); new OutputRedirector(app.getInputStream(), getClass().getName() + ".child", TF); assertEquals(0, app.waitFor()); }
@Test public void testSparkArgumentHandling() throws Exception { SparkSubmitOptionParser opts = new SparkSubmitOptionParser();
@Test public void testSparkArgumentHandling() throws Exception { SparkSubmitOptionParser opts = new SparkSubmitOptionParser();
@Test public void testSparkArgumentHandling() throws Exception { SparkSubmitOptionParser opts = new SparkSubmitOptionParser();
@Test public void testInProcessLauncherDoesNotKillJvm() throws Exception { SparkSubmitOptionParser opts = new SparkSubmitOptionParser(); List<String[]> wrongArgs = Arrays.asList( new String[] { "--unknown" }, new String[] { opts.DEPLOY_MODE, "invalid" }); for (String[] args : wrongArgs) { InProcessLauncher launcher = new InProcessLauncher() .setAppResource(SparkLauncher.NO_RESOURCE); switch (args.length) { case 2: launcher.addSparkArg(args[0], args[1]); break; case 1: launcher.addSparkArg(args[0]); break; default: fail("FIXME: invalid test."); } SparkAppHandle handle = launcher.startApplication(); waitFor(handle); assertEquals(SparkAppHandle.State.FAILED, handle.getState()); } // Run --version, which is useless as a use case, but should succeed and not exit the JVM. // The expected state is "LOST" since "--version" doesn't report state back to the handle. SparkAppHandle handle = new InProcessLauncher().addSparkArg(opts.VERSION).startApplication(); waitFor(handle); assertEquals(SparkAppHandle.State.LOST, handle.getState()); }
@Test public void testInProcessLauncherDoesNotKillJvm() throws Exception { SparkSubmitOptionParser opts = new SparkSubmitOptionParser(); List<String[]> wrongArgs = Arrays.asList( new String[] { "--unknown" }, new String[] { opts.DEPLOY_MODE, "invalid" }); for (String[] args : wrongArgs) { InProcessLauncher launcher = new InProcessLauncher() .setAppResource(SparkLauncher.NO_RESOURCE); switch (args.length) { case 2: launcher.addSparkArg(args[0], args[1]); break; case 1: launcher.addSparkArg(args[0]); break; default: fail("FIXME: invalid test."); } SparkAppHandle handle = launcher.startApplication(); waitFor(handle); assertEquals(SparkAppHandle.State.FAILED, handle.getState()); } // Run --version, which is useless as a use case, but should succeed and not exit the JVM. // The expected state is "LOST" since "--version" doesn't report state back to the handle. SparkAppHandle handle = new InProcessLauncher().addSparkArg(opts.VERSION).startApplication(); waitFor(handle); assertEquals(SparkAppHandle.State.LOST, handle.getState()); }
@BeforeClass public static void setUp() throws Exception { dummyPropsFile = File.createTempFile("spark", "properties"); parser = new SparkSubmitOptionParser(); }
@BeforeClass public static void setUp() throws Exception { dummyPropsFile = File.createTempFile("spark", "properties"); parser = new SparkSubmitOptionParser(); }
List<String> buildSparkSubmitArgs() { List<String> args = new ArrayList<>(); SparkSubmitOptionParser parser = new SparkSubmitOptionParser();
List<String> buildSparkSubmitArgs() { List<String> args = new ArrayList<>(); SparkSubmitOptionParser parser = new SparkSubmitOptionParser();