private static Configuration readConfigurationFromDisk(
          final String configPath, final ConfigurationSerializer serializer) {

    LOG.log(Level.FINER, "Loading configuration file: {0}", configPath);

    final File evaluatorConfigFile = new File(configPath);

    if (!evaluatorConfigFile.exists()) {
      throw fatal(
          "Configuration file " + configPath + " does not exist. Can be an issue in job submission.",
          new FileNotFoundException(configPath));
    }

    if (!evaluatorConfigFile.canRead()) {
      throw fatal(
          "Configuration file " + configPath + " exists, but can't be read.",
          new IOException(configPath));
    }

    try {

      final Configuration config = serializer.fromFile(evaluatorConfigFile);
      LOG.log(Level.FINEST, "Configuration file loaded: {0}", configPath);

      return config;

    } catch (final IOException e) {
      throw fatal("Unable to parse the configuration file: " + configPath, e);
    }
  }
private static Configuration readConfigurationFromDisk ( final String configPath , final ConfigurationSerializer serializer ) { LOG . log ( Level . FINER , "Loading configuration file: {0}" , configPath ) ; final File evaluatorConfigFile = new File ( configPath ) ; if ( ! evaluatorConfigFile . exists ( ) ) { throw fatal ( "Configuration file " + configPath + " does not exist. Can be an issue in job submission." , new FileNotFoundException ( configPath ) ) ; } if ( ! evaluatorConfigFile . canRead ( ) ) { throw fatal ( "Configuration file " + configPath + " exists, but can't be read." , new IOException ( configPath ) ) ; } try { final Configuration config = serializer . fromFile ( evaluatorConfigFile ) ; LOG . log ( Level . FINEST , "Configuration file loaded: {0}" , configPath ) ; return config ; } catch ( final IOException e ) { throw fatal ( "Unable to parse the configuration file: " + configPath , e ) ; } }
Read configuration from a given file and deserialize it
into Tang configuration object that can be used for injection.
Configuration is currently serialized using Avro.
This method also prints full deserialized configuration into log.
@param configPath Path to the local file that contains serialized configuration
of a REEF component to launch (can be either Driver or Evaluator).
@param serializer An object to deserialize the configuration file.
@return Tang configuration read and deserialized from a given file.