@VisibleForTesting
  static void outputConfigToFile(Config config) throws IOException {
    // If a file path is specified then write the Azkaban config to that path in HOCON format.
    // This can be used to generate an application.conf file to pass to the yarn app master and containers.
    if (config.hasPath(AZKABAN_CONFIG_OUTPUT_PATH)) {
      File configFile = new File(config.getString(AZKABAN_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);
    }
  }
@ VisibleForTesting static void outputConfigToFile ( Config config ) throws IOException { if ( config . hasPath ( AZKABAN_CONFIG_OUTPUT_PATH ) ) { File configFile = new File ( config . getString ( AZKABAN_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 ) ; } }
Write the config to the file specified with the config key {@value AZKABAN_CONFIG_OUTPUT_PATH} if it
is configured.
@param config the config to output
@throws IOException