/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.elasticmapreduce.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Specification for a cluster (job flow) step. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class StepConfig implements Serializable, Cloneable, StructuredPojo { /** ** The name of the step. *
*/ private String name; /** ** The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* The JAR file used for the step. *
*/ private HadoopJarStepConfig hadoopJarStep; /** * Default constructor for StepConfig object. Callers should use the setter or fluent setter (with...) methods to * initialize the object after creating it. */ public StepConfig() { } /** * Constructs a new StepConfig object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param name * The name of the step. * @param hadoopJarStep * The JAR file used for the step. */ public StepConfig(String name, HadoopJarStepConfig hadoopJarStep) { setName(name); setHadoopJarStep(hadoopJarStep); } /** ** The name of the step. *
* * @param name * The name of the step. */ public void setName(String name) { this.name = name; } /** ** The name of the step. *
* * @return The name of the step. */ public String getName() { return this.name; } /** ** The name of the step. *
* * @param name * The name of the step. * @return Returns a reference to this object so that method calls can be chained together. */ public StepConfig withName(String name) { setName(name); return this; } /** ** The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the
* WAITING
state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running,
* the ActionOnFailure
parameter may not behave as you expect. In this case, for a step that
* fails with this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not
* canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster
* does not terminate.
* @see ActionOnFailure
*/
public void setActionOnFailure(String actionOnFailure) {
this.actionOnFailure = actionOnFailure;
}
/**
*
* The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the
* WAITING
state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running,
* the ActionOnFailure
parameter may not behave as you expect. In this case, for a step that
* fails with this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not
* canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster
* does not terminate.
* @see ActionOnFailure
*/
public String getActionOnFailure() {
return this.actionOnFailure;
}
/**
*
* The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the
* WAITING
state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running,
* the ActionOnFailure
parameter may not behave as you expect. In this case, for a step that
* fails with this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not
* canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster
* does not terminate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ActionOnFailure
*/
public StepConfig withActionOnFailure(String actionOnFailure) {
setActionOnFailure(actionOnFailure);
return this;
}
/**
*
* The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the
* WAITING
state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running,
* the ActionOnFailure
parameter may not behave as you expect. In this case, for a step that
* fails with this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not
* canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster
* does not terminate.
* @see ActionOnFailure
*/
public void setActionOnFailure(ActionOnFailure actionOnFailure) {
withActionOnFailure(actionOnFailure);
}
/**
*
* The action to take when the step fails. Use one of the following values: *
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the WAITING
* state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running, the
* ActionOnFailure
parameter may not behave as you expect. In this case, for a step that fails with
* this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not canceled; for a
* step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster does not terminate.
*
* TERMINATE_CLUSTER
- Shuts down the cluster.
*
* CANCEL_AND_WAIT
- Cancels any pending steps and returns the cluster to the
* WAITING
state.
*
* CONTINUE
- Continues to the next step in the queue.
*
* TERMINATE_JOB_FLOW
- Shuts down the cluster. TERMINATE_JOB_FLOW
is provided for
* backward compatibility. We recommend using TERMINATE_CLUSTER
instead.
*
* If a cluster's StepConcurrencyLevel
is greater than 1
, do not use
* AddJobFlowSteps
to submit a step with this parameter set to CANCEL_AND_WAIT
or
* TERMINATE_CLUSTER
. The step is not submitted and the action fails with a message that the
* ActionOnFailure
setting is not valid.
*
* If you change a cluster's StepConcurrencyLevel
to be greater than 1 while a step is running,
* the ActionOnFailure
parameter may not behave as you expect. In this case, for a step that
* fails with this parameter set to CANCEL_AND_WAIT
, pending steps and the running step are not
* canceled; for a step that fails with this parameter set to TERMINATE_CLUSTER
, the cluster
* does not terminate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ActionOnFailure
*/
public StepConfig withActionOnFailure(ActionOnFailure actionOnFailure) {
this.actionOnFailure = actionOnFailure.toString();
return this;
}
/**
*
* The JAR file used for the step. *
* * @param hadoopJarStep * The JAR file used for the step. */ public void setHadoopJarStep(HadoopJarStepConfig hadoopJarStep) { this.hadoopJarStep = hadoopJarStep; } /** ** The JAR file used for the step. *
* * @return The JAR file used for the step. */ public HadoopJarStepConfig getHadoopJarStep() { return this.hadoopJarStep; } /** ** The JAR file used for the step. *
* * @param hadoopJarStep * The JAR file used for the step. * @return Returns a reference to this object so that method calls can be chained together. */ public StepConfig withHadoopJarStep(HadoopJarStepConfig hadoopJarStep) { setHadoopJarStep(hadoopJarStep); 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getActionOnFailure() != null) sb.append("ActionOnFailure: ").append(getActionOnFailure()).append(","); if (getHadoopJarStep() != null) sb.append("HadoopJarStep: ").append(getHadoopJarStep()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof StepConfig == false) return false; StepConfig other = (StepConfig) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getActionOnFailure() == null ^ this.getActionOnFailure() == null) return false; if (other.getActionOnFailure() != null && other.getActionOnFailure().equals(this.getActionOnFailure()) == false) return false; if (other.getHadoopJarStep() == null ^ this.getHadoopJarStep() == null) return false; if (other.getHadoopJarStep() != null && other.getHadoopJarStep().equals(this.getHadoopJarStep()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getActionOnFailure() == null) ? 0 : getActionOnFailure().hashCode()); hashCode = prime * hashCode + ((getHadoopJarStep() == null) ? 0 : getHadoopJarStep().hashCode()); return hashCode; } @Override public StepConfig clone() { try { return (StepConfig) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.elasticmapreduce.model.transform.StepConfigMarshaller.getInstance().marshall(this, protocolMarshaller); } }