Source:
private static void start() throws Exception { TwillPreparer preparer = null; if (twillIdExists()) { String runId = getTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(runId)); if ((controller != null) && controller.isRunning()) { System.out.println("WARNING - A YARN application is already running for this Fluo instance! Please stop it before starting a new one."); System.exit(-1); } else { log.warn(existsButNotRunningMsg()); System.exit(-1); } } if (!config.hasRequiredOracleProps() || !config.hasRequiredWorkerProps()) { log.error("fluo.properties is missing required properties for oracle"); System.exit(-1); } preparer = twillRunner.prepare(new FluoTwillApp(config, options.getFluoConf())); File observerDir = new File(options.getFluoLib() + "/observers"); for (File f : observerDir.listFiles()) { String jarPath = "file:" + f.getCanonicalPath(); log.debug("Adding observer jar (" + f.getName() + ") to Fluo instance."); preparer.withResources(new URI(jarPath)); } Preconditions.checkNotNull(preparer, "Failed to prepare twill application"); TwillController controller = preparer.start(); log.info("Starting Fluo instance in YARN..."); controller.start(); String twillId = controller.getRunId().toString(); CuratorUtil.putData(curator, twillIdPath(), twillId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.FAIL); while (controller.isRunning() == false) { Thread.sleep(500); } String appId = controller.getResourceReport().getApplicationId(); CuratorUtil.putData(curator, appIdPath(), appId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.FAIL); log.info("Started Fluo instance in YARN " + getAppInfo()); }

Target:
private static void start() throws Exception { TwillPreparer preparer = null; if (twillIdExists()) { String runId = getTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(runId)); if ((controller != null) && controller.isRunning()) { System.err.println("WARNING - A YARN application is already running for this Fluo instance! Please stop it before starting a new one."); System.exit(-1); } else { logExistsButNotRunning(); System.exit(-1); } } if (!config.hasRequiredOracleProps() || !config.hasRequiredWorkerProps()) { System.err.println("Failed to start Fluo instance because fluo.properties is missing required properties."); System.exit(-1); } preparer = twillRunner.prepare(new FluoTwillApp(config, options.getFluoConf())); File observerDir = new File(options.getFluoLib() + OBSERVER_DIR); for (File f : observerDir.listFiles()) { String jarPath = "file:" + f.getCanonicalPath(); log.debug("Adding observer jar (" + f.getName() + ") to Fluo instance."); preparer.withResources(new URI(jarPath)); } Preconditions.checkNotNull(preparer, "Failed to prepare twill application"); TwillController controller = preparer.start(); log.info("Starting Fluo instance in YARN..."); controller.start(); String twillId = controller.getRunId().toString(); CuratorUtil.putData(curator, twillIdPath(), twillId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.FAIL); while (controller.isRunning() == false) { Thread.sleep(500); } String appId = controller.getResourceReport().getApplicationId(); CuratorUtil.putData(curator, appIdPath(), appId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.FAIL); log.info("Started Fluo instance in YARN " + getAppInfo()); }