Example usage for com.amazonaws.services.elasticmapreduce.model StepStatus StepStatus

List of usage examples for com.amazonaws.services.elasticmapreduce.model StepStatus StepStatus

Introduction

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

Prototype

StepStatus

Source Link

Usage

From source file:org.finra.dm.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public ListStepsResult listStepsRequest(AmazonElasticMapReduceClient emrClient,
        ListStepsRequest listStepsRequest) {
    MockEmrJobFlow cluster = getClusterById(listStepsRequest.getClusterId());

    if (cluster == null) {
        throw new AmazonServiceException("No cluster found with jobFlowId: " + listStepsRequest.getClusterId());
    }//w  w w  . j  av a  2s .co  m

    List<StepSummary> steps = new ArrayList<>();

    // Add steps that are in these states
    for (MockEmrJobFlow step : cluster.getSteps()) {
        if ((listStepsRequest.getStepStates() == null || listStepsRequest.getStepStates().isEmpty())
                || listStepsRequest.getStepStates().contains(step.getStatus())) {
            StepSummary stepSummary = new StepSummary().withId(step.getJobFlowId())
                    .withName(step.getJobFlowName()).withStatus(new StepStatus().withState(step.getStatus()));
            steps.add(stepSummary);
        }
    }

    return new ListStepsResult().withSteps(steps);
}

From source file:org.finra.dm.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public DescribeStepResult describeStepRequest(AmazonElasticMapReduceClient emrClient,
        DescribeStepRequest describeStepRequest) {
    MockEmrJobFlow cluster = getClusterById(describeStepRequest.getClusterId());

    if (cluster == null) {
        throw new AmazonServiceException(
                "No cluster found with jobFlowId: " + describeStepRequest.getClusterId());
    }/*from   www.ja v a2s .c  om*/

    Step stepResult = null;
    // Add steps that are in these states
    for (MockEmrJobFlow step : cluster.getSteps()) {
        if (describeStepRequest.getStepId().equalsIgnoreCase(step.getJobFlowId())) {
            HadoopStepConfig hadoopStepConfig = new HadoopStepConfig().withJar(step.getJarLocation());
            stepResult = new Step().withId(step.getJobFlowId()).withName(step.getJobFlowName())
                    .withStatus(new StepStatus().withState(step.getStatus())).withConfig(hadoopStepConfig);
            break;
        }
    }

    return new DescribeStepResult().withStep(stepResult);
}

From source file:org.finra.herd.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public ListStepsResult listStepsRequest(AmazonElasticMapReduceClient emrClient,
        ListStepsRequest listStepsRequest) {
    MockEmrJobFlow cluster = getClusterById(listStepsRequest.getClusterId());

    if (cluster == null) {
        throw new AmazonServiceException("No cluster found with jobFlowId: " + listStepsRequest.getClusterId());
    }/* www . ja  v  a2 s . c  o m*/

    List<StepSummary> steps = new ArrayList<>();

    // Add steps that are in these states
    for (MockEmrJobFlow step : cluster.getSteps()) {
        if ((listStepsRequest.getStepStates() == null || listStepsRequest.getStepStates().isEmpty())
                || listStepsRequest.getStepStates().contains(step.getStatus())) {
            StepSummary stepSummary = new StepSummary().withId(step.getJobFlowId())
                    .withName(step.getJobFlowName()).withStatus(new StepStatus().withState(step.getStatus()))
                    .withConfig(new HadoopStepConfig().withJar(step.getJarLocation()));
            steps.add(stepSummary);
        }
    }

    return new ListStepsResult().withSteps(steps);
}

From source file:org.finra.herd.dao.impl.MockEmrOperationsImpl.java

License:Apache License

@Override
public DescribeStepResult describeStepRequest(AmazonElasticMapReduceClient emrClient,
        DescribeStepRequest describeStepRequest) {
    MockEmrJobFlow cluster = getClusterById(describeStepRequest.getClusterId());

    if (cluster == null) {
        throw new AmazonServiceException(
                "No cluster found with jobFlowId: " + describeStepRequest.getClusterId());
    }/*from w w  w  .  jav  a2 s  . c  o m*/

    Step stepResult = null;
    // Add steps that are in these states
    for (MockEmrJobFlow step : cluster.getSteps()) {
        if (describeStepRequest.getStepId().equalsIgnoreCase(step.getJobFlowId())) {
            HadoopStepConfig hadoopStepConfig = new HadoopStepConfig().withJar(step.getJarLocation());
            stepResult = new Step().withId(step.getJobFlowId()).withName(step.getJobFlowName())
                    .withStatus(new StepStatus().withState(step.getStatus())).withConfig(hadoopStepConfig);

            if (stepResult.getName().equalsIgnoreCase(MOCK_STEP_WITHOUT_ID_NAME)) {
                stepResult.setId(null);
            }

            break;
        }
    }

    return new DescribeStepResult().withStep(stepResult);
}