Example usage for com.amazonaws.services.elasticmapreduce.model ListStepsRequest getClusterId

List of usage examples for com.amazonaws.services.elasticmapreduce.model ListStepsRequest getClusterId

Introduction

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

Prototype


public String getClusterId() 

Source Link

Document

The identifier of the cluster for which to list the steps.

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());
    }/*from  w  w  w .  j a v  a2s  . 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()));
            steps.add(stepSummary);
        }
    }

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

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());
    }//w  ww .  j  a  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);
}