@Test public void testOutputConfig() throws IOException { File tmpTestDir = com.google.common.io.Files.createTempDir(); try { Path outputPath = Paths.get(tmpTestDir.toString(), "application.conf"); Config config = ConfigFactory.empty() .withValue(ConfigurationKeys.FS_URI_KEY, ConfigValueFactory.fromAnyRef("file: .withValue(GobblinYarnAppLauncher.GOBBLIN_YARN_CONFIG_OUTPUT_PATH, ConfigValueFactory.fromAnyRef(outputPath.toString())); GobblinYarnAppLauncher.outputConfigToFile(config); String configString = com.google.common.io.Files.toString(outputPath.toFile(), Charsets.UTF_8); Assert.assertTrue(configString.contains("fs")); } finally { FileUtils.deleteDirectory(tmpTestDir); } }
@VisibleForTesting static void outputConfigToFile(Config config) throws IOException { if (config.hasPath(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)) { File configFile = new File(config.getString(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)); File parentDir = configFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { if (!parentDir.mkdirs()) { throw new IOException("Error creating directories for " + parentDir); } } ConfigRenderOptions configRenderOptions = ConfigRenderOptions.defaults(); configRenderOptions = configRenderOptions.setComments(false); configRenderOptions = configRenderOptions.setOriginComments(false); configRenderOptions = configRenderOptions.setFormatted(true); configRenderOptions = configRenderOptions.setJson(false); String renderedConfig = config.root().render(configRenderOptions); FileUtils.writeStringToFile(configFile, renderedConfig, Charsets.UTF_8); } }
GobblinYarnAppLauncher { @VisibleForTesting static void outputConfigToFile(Config config) throws IOException { if (config.hasPath(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)) { File configFile = new File(config.getString(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)); File parentDir = configFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { if (!parentDir.mkdirs()) { throw new IOException("Error creating directories for " + parentDir); } } ConfigRenderOptions configRenderOptions = ConfigRenderOptions.defaults(); configRenderOptions = configRenderOptions.setComments(false); configRenderOptions = configRenderOptions.setOriginComments(false); configRenderOptions = configRenderOptions.setFormatted(true); configRenderOptions = configRenderOptions.setJson(false); String renderedConfig = config.root().render(configRenderOptions); FileUtils.writeStringToFile(configFile, renderedConfig, Charsets.UTF_8); } } }
GobblinYarnAppLauncher { @VisibleForTesting static void outputConfigToFile(Config config) throws IOException { if (config.hasPath(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)) { File configFile = new File(config.getString(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)); File parentDir = configFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { if (!parentDir.mkdirs()) { throw new IOException("Error creating directories for " + parentDir); } } ConfigRenderOptions configRenderOptions = ConfigRenderOptions.defaults(); configRenderOptions = configRenderOptions.setComments(false); configRenderOptions = configRenderOptions.setOriginComments(false); configRenderOptions = configRenderOptions.setFormatted(true); configRenderOptions = configRenderOptions.setJson(false); String renderedConfig = config.root().render(configRenderOptions); FileUtils.writeStringToFile(configFile, renderedConfig, Charsets.UTF_8); } } GobblinYarnAppLauncher(Config config, YarnConfiguration yarnConfiguration); }
GobblinYarnAppLauncher { @VisibleForTesting static void outputConfigToFile(Config config) throws IOException { if (config.hasPath(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)) { File configFile = new File(config.getString(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)); File parentDir = configFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { if (!parentDir.mkdirs()) { throw new IOException("Error creating directories for " + parentDir); } } ConfigRenderOptions configRenderOptions = ConfigRenderOptions.defaults(); configRenderOptions = configRenderOptions.setComments(false); configRenderOptions = configRenderOptions.setOriginComments(false); configRenderOptions = configRenderOptions.setFormatted(true); configRenderOptions = configRenderOptions.setJson(false); String renderedConfig = config.root().render(configRenderOptions); FileUtils.writeStringToFile(configFile, renderedConfig, Charsets.UTF_8); } } GobblinYarnAppLauncher(Config config, YarnConfiguration yarnConfiguration); void launch(); synchronized void stop(); @Subscribe void handleApplicationReportArrivalEvent(ApplicationReportArrivalEvent applicationReportArrivalEvent); @Subscribe void handleGetApplicationReportFailureEvent(
      GetApplicationReportFailureEvent getApplicationReportFailureEvent); static void main(String[] args); }
GobblinYarnAppLauncher { @VisibleForTesting static void outputConfigToFile(Config config) throws IOException { if (config.hasPath(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)) { File configFile = new File(config.getString(GOBBLIN_YARN_CONFIG_OUTPUT_PATH)); File parentDir = configFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { if (!parentDir.mkdirs()) { throw new IOException("Error creating directories for " + parentDir); } } ConfigRenderOptions configRenderOptions = ConfigRenderOptions.defaults(); configRenderOptions = configRenderOptions.setComments(false); configRenderOptions = configRenderOptions.setOriginComments(false); configRenderOptions = configRenderOptions.setFormatted(true); configRenderOptions = configRenderOptions.setJson(false); String renderedConfig = config.root().render(configRenderOptions); FileUtils.writeStringToFile(configFile, renderedConfig, Charsets.UTF_8); } } GobblinYarnAppLauncher(Config config, YarnConfiguration yarnConfiguration); void launch(); synchronized void stop(); @Subscribe void handleApplicationReportArrivalEvent(ApplicationReportArrivalEvent applicationReportArrivalEvent); @Subscribe void handleGetApplicationReportFailureEvent(
      GetApplicationReportFailureEvent getApplicationReportFailureEvent); static void main(String[] args); static final String GOBBLIN_YARN_CONFIG_OUTPUT_PATH; static final String GOBBLIN_YARN_APP_LAUNCHER_MODE; static final String DEFAULT_GOBBLIN_YARN_APP_LAUNCHER_MODE; static final String AZKABAN_APP_LAUNCHER_MODE_KEY; }