Search in sources :

Example 1 with HadoopJarStepConfig

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

the class EmrShellStepHelper method getEmrStepConfig.

@Override
public StepConfig getEmrStepConfig(Object step) {
    EmrShellStep emrShellStep = (EmrShellStep) step;
    // Hadoop Jar provided by Amazon for running Shell Scripts
    String hadoopJarForShellScript = configurationHelper.getProperty(ConfigurationValue.EMR_SHELL_SCRIPT_JAR);
    // Default ActionOnFailure is to cancel the execution and wait
    ActionOnFailure actionOnFailure = ActionOnFailure.CANCEL_AND_WAIT;
    if (emrShellStep.isContinueOnError() != null && emrShellStep.isContinueOnError()) {
        // Override based on user input
        actionOnFailure = ActionOnFailure.CONTINUE;
    }
    // Add the script location
    List<String> argsList = new ArrayList<>();
    argsList.add(emrShellStep.getScriptLocation().trim());
    // Add the script arguments
    if (!CollectionUtils.isEmpty(emrShellStep.getScriptArguments())) {
        for (String argument : emrShellStep.getScriptArguments()) {
            argsList.add(argument.trim());
        }
    }
    // Return the StepConfig object
    HadoopJarStepConfig jarConfig = new HadoopJarStepConfig(hadoopJarForShellScript).withArgs(argsList);
    return new StepConfig().withName(emrShellStep.getStepName().trim()).withActionOnFailure(actionOnFailure).withHadoopJarStep(jarConfig);
}
Also used : HadoopJarStepConfig(com.amazonaws.services.elasticmapreduce.model.HadoopJarStepConfig) ActionOnFailure(com.amazonaws.services.elasticmapreduce.model.ActionOnFailure) EmrShellStep(org.finra.herd.model.api.xml.EmrShellStep) ArrayList(java.util.ArrayList) StepConfig(com.amazonaws.services.elasticmapreduce.model.StepConfig) HadoopJarStepConfig(com.amazonaws.services.elasticmapreduce.model.HadoopJarStepConfig)

Aggregations

ActionOnFailure (com.amazonaws.services.elasticmapreduce.model.ActionOnFailure)1 HadoopJarStepConfig (com.amazonaws.services.elasticmapreduce.model.HadoopJarStepConfig)1 StepConfig (com.amazonaws.services.elasticmapreduce.model.StepConfig)1 ArrayList (java.util.ArrayList)1 EmrShellStep (org.finra.herd.model.api.xml.EmrShellStep)1