@Override public TwillPreparer enableDebugging(String... runnables) { getDelegate().enableDebugging(runnables); return this; }
@Override public TwillPreparer enableDebugging(boolean doSuspend, String... runnables) { getDelegate().enableDebugging(doSuspend, runnables); return this; }
@Override public TwillPreparer enableDebugging(boolean doSuspend, String... runnables) { getDelegate().enableDebugging(doSuspend, runnables); return this; }
@Override public TwillPreparer enableDebugging(String... runnables) { getDelegate().enableDebugging(runnables); return this; }
@Override public TwillController launch(TwillApplication twillApplication) { TwillPreparer twillPreparer = twillRunner .prepare(twillApplication); if (options.isDebug()) { LOG.info("Starting {} with debugging enabled.", program.getId()); twillPreparer.enableDebugging(); } TwillController twillController = twillPreparer .withDependencies(new HBaseTableUtilFactory().get().getClass()) .addSecureStore(YarnSecureStore.create(HBaseTokenUtils.obtainToken(hConf, new Credentials()))) .withApplicationArguments( String.format("--%s", RunnableOptions.JAR), copiedProgram.getJarLocation().getName(), String.format("--%s", RunnableOptions.RUNTIME_ARGS), runtimeArgs ).start(); return addCleanupListener(twillController, hConfFile, cConfFile, copiedProgram, programDir); } });
preparer.enableDebugging(true, YARN_RUNNABLE_NAME);
@Test public void testDebugPortOneRunnable() throws Exception { YarnTwillRunnerService runner = getTwillRunner(); runner.start(); TwillController controller = runner.prepare(new DummyApplication()) .enableDebugging("r1") .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out))) .start(); final CountDownLatch running = new CountDownLatch(1); controller.onRunning(new Runnable() { @Override public void run() { running.countDown(); } }, Threads.SAME_THREAD_EXECUTOR); Assert.assertTrue(running.await(120, TimeUnit.SECONDS)); Assert.assertTrue(waitForDebugPort(controller, "r1", 30)); controller.terminate().get(120, TimeUnit.SECONDS); // Sleep a bit before exiting. TimeUnit.SECONDS.sleep(2); }
@Test public void testDebugPortAllRunnables() throws Exception { YarnTwillRunnerService runner = getTwillRunner(); runner.start(); TwillController controller = runner.prepare(new DummyApplication()) .enableDebugging() .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out))) .start(); final CountDownLatch running = new CountDownLatch(1); controller.onRunning(new Runnable() { @Override public void run() { running.countDown(); } }, Threads.SAME_THREAD_EXECUTOR); Assert.assertTrue(running.await(120, TimeUnit.SECONDS)); Assert.assertTrue(waitForDebugPort(controller, "r1", 30)); Assert.assertTrue(waitForDebugPort(controller, "r2", 30)); controller.terminate().get(120, TimeUnit.SECONDS); // Sleep a bit before exiting. TimeUnit.SECONDS.sleep(2); } }
twillPreparer.enableDebugging();
twillPreparer.enableDebugging();