public class ResizeJobFlowStep extends Object
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AmazonElasticMapReduce emr = new AmazonElasticMapReduceClient(credentials);
HadoopJarStepConfig config = new ResizeJobFlowStep()
.withResizeAction(new ModifyInstanceGroup()
.withInstanceGroup("core")
.withInstanceCount(10))
.withResizeAction(new AddInstanceGroup()
.withInstanceGroup("task")
.withInstanceCount(10)
.withInstanceType("m1.small"))
.withOnArrested(OnArrested.Continue)
.withOnFailure(OnFailure.Continue)
.toHadoopJarStepConfig();
StepConfig resizeJobFlow = new StepConfig()
.withName("Resize job flow")
.withActionOnFailure("TERMINATE_JOB_FLOW")
.withHadoopJarStep(config);
RunJobFlowRequest request = new RunJobFlowRequest()
.withName("Resize job flow")
.withSteps(resizeJobFlow)
.withLogUri("s3://log-bucket/")
.withInstances(new JobFlowInstancesConfig()
.withEc2KeyName("keypair")
.withHadoopVersion("0.20")
.withInstanceCount(5)
.withKeepJobFlowAliveWhenNoSteps(true)
.withMasterInstanceType("m1.small")
.withSlaveInstanceType("m1.small"));
RunJobFlowResult result = emr.runJobFlow(request);
| Modifier and Type | Class and Description |
|---|---|
static class |
ResizeJobFlowStep.AddInstanceGroup
Class representing creating a new instance group.
|
static class |
ResizeJobFlowStep.ModifyInstanceGroup
Class representing a change to an existing instance group.
|
static class |
ResizeJobFlowStep.OnArrested
The action to take if your step is waiting for the instance group to start
and it enters the Arrested state.
|
static class |
ResizeJobFlowStep.OnFailure
Action to take if there is a failure modifying your cluster composition.
|
static interface |
ResizeJobFlowStep.ResizeAction |
| Constructor and Description |
|---|
ResizeJobFlowStep()
Creates a new ResizeJobFlowStep using the default Elastic Map Reduce
bucket (us-east-1.elasticmapreduce) for the default (us-east-1) region.
|
ResizeJobFlowStep(String bucket)
Creates a new ResizeJobFlowStep using the specified Amazon S3 bucket to
load resources.
|
| Modifier and Type | Method and Description |
|---|---|
HadoopJarStepConfig |
toHadoopJarStepConfig()
Creates the final HadoopJarStepConfig once you are done configuring the step.
|
ResizeJobFlowStep |
withOnArrested(ResizeJobFlowStep.OnArrested onArrested)
What action this step should take if any of the instance group modifications result
in the instance group entering Arrested state.
|
ResizeJobFlowStep |
withOnFailure(ResizeJobFlowStep.OnFailure onFailure)
What action this step should take if the modification fails.
|
ResizeJobFlowStep |
withResizeAction(ResizeJobFlowStep.ResizeAction resizeAction)
Add a new action for this step to perform.
|
ResizeJobFlowStep |
withWait(boolean wait)
Specifies whether the step should wait for the modification to complete
or if it should just continue onto the next step once the modification
request is received.
|
public ResizeJobFlowStep()
public ResizeJobFlowStep(String bucket)
The official bucket format is "<region>.elasticmapreduce", so if you're using the us-east-1 region, you should use the bucket "us-east-1.elasticmapreduce".
bucket - The Amazon S3 bucket from which to load resources.public ResizeJobFlowStep withResizeAction(ResizeJobFlowStep.ResizeAction resizeAction)
resizeAction - An instance of ResizeAction defining the change.public ResizeJobFlowStep withWait(boolean wait)
wait - Whether this step should wait for the modification to complete.public ResizeJobFlowStep withOnArrested(ResizeJobFlowStep.OnArrested onArrested)
onArrested - Enum specifying which action to take.public ResizeJobFlowStep withOnFailure(ResizeJobFlowStep.OnFailure onFailure)
onFailure - Enum specifying which action to take.public HadoopJarStepConfig toHadoopJarStepConfig()