Example usage for com.amazonaws.services.elasticmapreduce.model StepConfig withActionOnFailure

List of usage examples for com.amazonaws.services.elasticmapreduce.model StepConfig withActionOnFailure

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticmapreduce.model StepConfig withActionOnFailure.

Prototype


public StepConfig withActionOnFailure(ActionOnFailure actionOnFailure) 

Source Link

Document

The action to take when the cluster step fails.

Usage

From source file:org.pentaho.amazon.client.impl.EmrClientImpl.java

License:Apache License

private StepConfig configureHiveStep(String stagingS3qUrl, String cmdLineArgs) {

    String[] cmdLineArgsArr;/*from w w  w . j a va  2 s .  c  om*/
    if (cmdLineArgs == null) {
        cmdLineArgsArr = new String[] { "" };
    } else {
        List<String> cmdArgs = Arrays.asList(cmdLineArgs.split("\\s+"));
        List<String> updatedCmdArgs = cmdArgs.stream().map(e -> replaceDoubleS3(e))
                .collect(Collectors.toList());
        cmdLineArgsArr = updatedCmdArgs.toArray(new String[updatedCmdArgs.size()]);
    }

    StepConfig hiveStepConfig = new StepConfig("Hive",
            new StepFactory().newRunHiveScriptStep(stagingS3qUrl, cmdLineArgsArr));
    if (alive) {
        hiveStepConfig.withActionOnFailure(ActionOnFailure.CANCEL_AND_WAIT);
    } else {
        hiveStepConfig.withActionOnFailure(ActionOnFailure.TERMINATE_JOB_FLOW);
    }
    return hiveStepConfig;
}

From source file:org.pentaho.amazon.client.impl.EmrClientImpl.java

License:Apache License

private StepConfig initHadoopStep(String jarUrl, String mainClass, List<String> jarStepArgs) {
    StepConfig stepConfig = new StepConfig();
    stepConfig.setName("custom jar: " + jarUrl);

    stepConfig.setHadoopJarStep(configureHadoopStep(jarUrl, mainClass, jarStepArgs));
    if (this.alive) {
        stepConfig.withActionOnFailure(ActionOnFailure.CANCEL_AND_WAIT);
    } else {/*  w w  w  . j av  a 2 s .  co m*/
        stepConfig.withActionOnFailure(ActionOnFailure.TERMINATE_JOB_FLOW);
    }
    return stepConfig;
}