@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeStepResult == false) return false; DescribeStepResult other = (DescribeStepResult) obj; if (other.getStep() == null ^ this.getStep() == null) return false; if (other.getStep() != null && other.getStep().equals(this.getStep()) == false) return false; return true; }
/** * <p> * The step details for the requested step identifier. * </p> * * @param step * The step details for the requested step identifier. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeStepResult withStep(Step step) { setStep(step); return this; }
public DescribeStepResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeStepResult describeStepResult = new DescribeStepResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return describeStepResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Step", targetDepth)) { context.nextToken(); describeStepResult.setStep(StepJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return describeStepResult; }
@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); }
@Override public DescribeStepResult answer(InvocationOnMock invocation) throws Throwable { DescribeStepRequest describeStepRequest = invocation.getArgument(1); assertEquals(clusterId, describeStepRequest.getClusterId()); assertEquals(stepId, describeStepRequest.getStepId()); DescribeStepResult describeStepResult = new DescribeStepResult(); describeStepResult.setStep(expectedStep); return describeStepResult; } });
public DescribeStepResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeStepResult describeStepResult = new DescribeStepResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return describeStepResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Step", targetDepth)) { context.nextToken(); describeStepResult.setStep(StepJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return describeStepResult; }
/** * <p> * The step details for the requested step identifier. * </p> * * @param step * The step details for the requested step identifier. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeStepResult withStep(Step step) { setStep(step); return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStep() != null) sb.append("Step: ").append(getStep()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeStepResult == false) return false; DescribeStepResult other = (DescribeStepResult) obj; if (other.getStep() == null ^ this.getStep() == null) return false; if (other.getStep() != null && other.getStep().equals(this.getStep()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStep() != null) sb.append("Step: ").append(getStep()); sb.append("}"); return sb.toString(); }
List<String> id = result.getStepIds(); DescribeStepResult res = client.describeStep(new DescribeStepRequest().withStepId(id.get(0))); StepStatus status = res.getStep().getStatus(); String stas = status.getState();
describe.setRequestCredentials(awsCreds); DescribeStepResult res = emr.describeStep(describe); StepStatus status = res.getStep().getStatus(); String stas = status.getState(); Thread.sleep(5000); res = emr.describeStep(describe); status = res.getStep().getStatus(); stas = status.getState(); log.info(stas);
@Override public Step getClusterStep(String clusterId, String stepId, AwsParamsDto awsParamsDto) { DescribeStepRequest describeStepRequest = new DescribeStepRequest().withClusterId(clusterId).withStepId(stepId); return emrOperations.describeStepRequest(getEmrClient(awsParamsDto), describeStepRequest).getStep(); }
@Override public Step getClusterStep(String clusterId, String stepId, AwsParamsDto awsParamsDto) { DescribeStepRequest describeStepRequest = new DescribeStepRequest().withClusterId(clusterId).withStepId(stepId); return emrOperations.describeStepRequest(getEmrClient(awsParamsDto), describeStepRequest).getStep(); }
private String getActualStepState() { String stepState = null; DescribeStepRequest describeStepRequest = new DescribeStepRequest(); describeStepRequest.setClusterId( hadoopJobFlowId ); describeStepRequest.setStepId( stepId ); DescribeStepResult describeStepResult = emrClient.describeStep( describeStepRequest ); if ( describeStepResult != null ) { stepState = describeStepResult.getStep().getStatus().getState(); } return stepState; }
.withClusterId(submission.clusterId()) .withStepId(lastStepId)) .getStep();