Search in sources :

Example 1 with StepStatus

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

the class MockEmrOperationsImpl method listStepsRequest.

@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());
    }
    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);
}
Also used : ListStepsResult(com.amazonaws.services.elasticmapreduce.model.ListStepsResult) StepSummary(com.amazonaws.services.elasticmapreduce.model.StepSummary) AmazonServiceException(com.amazonaws.AmazonServiceException) ArrayList(java.util.ArrayList) StepStatus(com.amazonaws.services.elasticmapreduce.model.StepStatus) HadoopStepConfig(com.amazonaws.services.elasticmapreduce.model.HadoopStepConfig)

Example 2 with StepStatus

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

the class MockEmrOperationsImpl method describeStepRequest.

@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());
    }
    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);
}
Also used : DescribeStepResult(com.amazonaws.services.elasticmapreduce.model.DescribeStepResult) AmazonServiceException(com.amazonaws.AmazonServiceException) Step(com.amazonaws.services.elasticmapreduce.model.Step) HadoopStepConfig(com.amazonaws.services.elasticmapreduce.model.HadoopStepConfig) StepStatus(com.amazonaws.services.elasticmapreduce.model.StepStatus)

Aggregations

AmazonServiceException (com.amazonaws.AmazonServiceException)2 HadoopStepConfig (com.amazonaws.services.elasticmapreduce.model.HadoopStepConfig)2 StepStatus (com.amazonaws.services.elasticmapreduce.model.StepStatus)2 DescribeStepResult (com.amazonaws.services.elasticmapreduce.model.DescribeStepResult)1 ListStepsResult (com.amazonaws.services.elasticmapreduce.model.ListStepsResult)1 Step (com.amazonaws.services.elasticmapreduce.model.Step)1 StepSummary (com.amazonaws.services.elasticmapreduce.model.StepSummary)1 ArrayList (java.util.ArrayList)1