AddJobFlowSteps
AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps are allowed in each job flow.
If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using SSH to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop.
A step specifies the location of a JAR file stored either on the master node of the cluster or in Amazon S3. Each step is performed by the main function of the main class of the JAR file. The main class can be specified either in the manifest of the JAR or by using the MainFunction parameter of the step.
Amazon EMR executes each step in the order listed. For a step to be considered complete, the main function must exit with a zero exit code and all Hadoop jobs started while the step was running must have completed and run successfully.
You can only add steps to a cluster that is in one of the following states: STARTING, BOOTSTRAPPING, RUNNING, or WAITING.
Note
The string values passed into HadoopJarStep
object cannot exceed a total
of 10240 characters.
Request Syntax
{
"ExecutionRoleArn": "string
",
"JobFlowId": "string
",
"Steps": [
{
"ActionOnFailure": "string
",
"HadoopJarStep": {
"Args": [ "string
" ],
"Jar": "string
",
"MainClass": "string
",
"Properties": [
{
"Key": "string
",
"Value": "string
"
}
]
},
"Name": "string
"
}
]
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- ExecutionRoleArn
-
The Amazon Resource Name (ARN) of the runtime role for a step on the cluster. The runtime role can be a cross-account IAM role. The runtime role ARN is a combination of account ID, role name, and role type using the following format:
arn:partition:service:region:account:resource
.For example,
arn:aws:IAM::1234567890:role/ReadOnly
is a correctly formatted runtime role ARN.Type: String
Length Constraints: Minimum length of 20. Maximum length of 2048.
Required: No
- JobFlowId
-
A string that uniquely identifies the job flow. This identifier is returned by RunJobFlow and can also be obtained from ListClusters.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 256.
Pattern:
[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: Yes
- Steps
-
A list of StepConfig to be executed by the job flow.
Type: Array of StepConfig objects
Required: Yes
Response Syntax
{
"StepIds": [ "string" ]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- StepIds
-
The identifiers of the list of steps added to the job flow.
Type: Array of strings
Length Constraints: Minimum length of 0. Maximum length of 256.
Pattern:
[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Errors
For information about the errors that are common to all actions, see Common Errors.
- InternalServerError
-
Indicates that an error occurred while processing the request and that the request was not completed.
HTTP Status Code: 400
Examples
Example
This example illustrates one usage of AddJobFlowSteps.
Sample Request
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: ElasticMapReduce.AddJobFlowSteps
Content-Length: 426
User-Agent: aws-sdk-ruby/1.9.2 ruby/1.9.3 i386-mingw32
Host: us-east-1.elasticmapreduce.amazonaws.com
X-Amz-Date: 20130716T210948Z
X-Amz-Content-Sha256: 9e5ad0a93c22224947ce98eea94f766103d91b28fa82eb60d0cb8b6f9555a6b2
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130716/us-east-1/elasticmapreduce/aws4_request, SignedHeaders=content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=2a2393390760ae85eb74ee3a539e1d758bfdd8815a1a6d6f14d4a2fbcfdcd5b7
Accept: */*
{
"JobFlowId": "j-3TS0OIYO4NFN",
"Steps": [{
"Name": "Example Jar Step",
"ActionOnFailure": "CANCEL_AND_WAIT",
"HadoopJarStep": {
"Jar": "s3n:\\/\\/elasticmapreduce\\/samples\\/cloudburst\\/cloudburst.jar",
"Args": [
"s3n:\\/\\/elasticmapreduce\\/samples\\/cloudburst\\/input\\/s_suis.br",
"s3n:\\/\\/elasticmapreduce\\/samples\\/cloudburst\\/input\\/100k.br",
"s3n:\\/\\/examples-bucket\\/cloudburst\\/output",
"36",
"3",
"0",
"1",
"240",
"48",
"24",
"24",
"128",
"16"
]
}
}]
}
Sample Response
HTTP/1.1 200 OK
x-amzn-RequestId: 6514261f-ee5b-11e2-9345-5332e9ab2e6d
Content-Type: application/x-amz-json-1.1
Content-Length: 0
Date: Tue, 16 Jul 2013 21:05:07 GMT
{
"StepIds": [
"s-1XXXXXXXXXXA"
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: