Search in sources :

Example 6 with BootstrapActionConfig

use of com.amazonaws.services.elasticmapreduce.model.BootstrapActionConfig in project herd by FINRAOS.

the class EmrDaoImpl method addHadoopBootstrapActionConfig.

private void addHadoopBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) {
    // Add hadoop Configuration support if needed
    if (!CollectionUtils.isEmpty(emrClusterDefinition.getHadoopConfigurations())) {
        ArrayList<String> argList = new ArrayList<>();
        BootstrapActionConfig hadoopBootstrapActionConfig = getBootstrapActionConfig(ConfigurationValue.EMR_CONFIGURE_HADOOP.getKey(), configurationHelper.getProperty(ConfigurationValue.EMR_CONFIGURE_HADOOP));
        // If config files are available, add them as arguments
        for (Object hadoopConfigObject : emrClusterDefinition.getHadoopConfigurations()) {
            // If the Config Files are available, add them as arguments
            if (hadoopConfigObject instanceof ConfigurationFiles) {
                for (ConfigurationFile configurationFile : ((ConfigurationFiles) hadoopConfigObject).getConfigurationFiles()) {
                    argList.add(configurationFile.getFileNameShortcut());
                    argList.add(configurationFile.getConfigFileLocation());
                }
            }
            // If the key value pairs are available, add them as arguments
            if (hadoopConfigObject instanceof KeyValuePairConfigurations) {
                for (KeyValuePairConfiguration keyValuePairConfiguration : ((KeyValuePairConfigurations) hadoopConfigObject).getKeyValuePairConfigurations()) {
                    argList.add(keyValuePairConfiguration.getKeyValueShortcut());
                    argList.add(keyValuePairConfiguration.getAttribKey() + "=" + keyValuePairConfiguration.getAttribVal());
                }
            }
        }
        // Add the bootstrap action with arguments
        hadoopBootstrapActionConfig.getScriptBootstrapAction().setArgs(argList);
        bootstrapActions.add(hadoopBootstrapActionConfig);
    }
}
Also used : KeyValuePairConfiguration(org.finra.herd.model.api.xml.KeyValuePairConfiguration) ArrayList(java.util.ArrayList) KeyValuePairConfigurations(org.finra.herd.model.api.xml.KeyValuePairConfigurations) ConfigurationFile(org.finra.herd.model.api.xml.ConfigurationFile) ConfigurationFiles(org.finra.herd.model.api.xml.ConfigurationFiles) BootstrapActionConfig(com.amazonaws.services.elasticmapreduce.model.BootstrapActionConfig) ScriptBootstrapActionConfig(com.amazonaws.services.elasticmapreduce.model.ScriptBootstrapActionConfig)

Aggregations

BootstrapActionConfig (com.amazonaws.services.elasticmapreduce.model.BootstrapActionConfig)6 ScriptBootstrapActionConfig (com.amazonaws.services.elasticmapreduce.model.ScriptBootstrapActionConfig)6 ArrayList (java.util.ArrayList)4 ScriptDefinition (org.finra.herd.model.api.xml.ScriptDefinition)3 ConfigurationFile (org.finra.herd.model.api.xml.ConfigurationFile)2 ConfigurationFiles (org.finra.herd.model.api.xml.ConfigurationFiles)2 KeyValuePairConfiguration (org.finra.herd.model.api.xml.KeyValuePairConfiguration)2 KeyValuePairConfigurations (org.finra.herd.model.api.xml.KeyValuePairConfigurations)2 Parameter (org.finra.herd.model.api.xml.Parameter)2 ClientConfiguration (com.amazonaws.ClientConfiguration)1 Application (com.amazonaws.services.elasticmapreduce.model.Application)1 Configuration (com.amazonaws.services.elasticmapreduce.model.Configuration)1 InstanceGroupConfig (com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig)1 RunJobFlowRequest (com.amazonaws.services.elasticmapreduce.model.RunJobFlowRequest)1 EmrClusterDefinition (org.finra.herd.model.api.xml.EmrClusterDefinition)1 EmrClusterDefinitionApplication (org.finra.herd.model.api.xml.EmrClusterDefinitionApplication)1 EmrClusterDefinitionConfiguration (org.finra.herd.model.api.xml.EmrClusterDefinitionConfiguration)1 HadoopJarStep (org.finra.herd.model.api.xml.HadoopJarStep)1 InstanceDefinition (org.finra.herd.model.api.xml.InstanceDefinition)1 InstanceDefinitions (org.finra.herd.model.api.xml.InstanceDefinitions)1