CancelSteps - Amazon EMR

CancelSteps

Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee that a step will be canceled, even if the request is successfully submitted. When you use Amazon EMR releases 5.28.0 and later, you can cancel steps that are in a PENDING or RUNNING state. In earlier versions of Amazon EMR, you can only cancel steps that are in a PENDING state.

Request Syntax

{ "ClusterId": "string", "StepCancellationOption": "string", "StepIds": [ "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.

ClusterId

The ClusterID for the specified steps that will be canceled. Use RunJobFlow and ListClusters to get ClusterIDs.

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

StepCancellationOption

The option to choose to cancel RUNNING steps. By default, the value is SEND_INTERRUPT.

Type: String

Valid Values: SEND_INTERRUPT | TERMINATE_PROCESS

Required: No

StepIds

The list of StepIDs to cancel. Use ListSteps to get steps and their states for the specified cluster.

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]*

Required: Yes

Response Syntax

{ "CancelStepsInfoList": [ { "Reason": "string", "Status": "string", "StepId": "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.

CancelStepsInfoList

A list of CancelStepsInfo, which shows the status of specified cancel requests for each StepID specified.

Type: Array of CancelStepsInfo objects

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

InvalidRequestException

This exception occurs when there is something wrong with user input.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of CancelSteps.

Sample Request

POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target: ElasticMapReduce.CancelSteps User-Agent: aws-sdk-ruby/1.9.2 ruby/1.9.3 i386-mingw32 Host: us-east-1.elasticmapreduce.amazonaws.com X-Amz-Date: 20160719T224800Z X-Amz-Content-Sha256: 9e5ad0a93c22224947ce98eea94f766103d91b28fa82eb60d0cb8b6f9555a6b2 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20160719/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: */* { "ClusterId": "j-2G7RS6DJZE39D", "StepIds": [ "s-11B5G7VIKHCZQ", "s-23PUT0NR3XF6O", "s-2NUYMUZ3ADACC", "s-10O5XO5JUY9OE", "s-CS88G2XK4N7X", "s-2M366D3KU4OTZ" ] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 84931a23-4e03-11e6-b2bd-0db72d19890a Content-Type: application/x-amz-json-1.1 Date: Tue, 19 Jul 2016 15:31:01 GMT { "CancelStepsInfoList": [ {"Reason": "This step cannot be cancelled.", "Status": "FAILED", "StepId": "s-11B5G7VIKHCZQ"}, {"Reason": "Cannot cancel the step. It is already COMPLETED.", "Status": "FAILED", "StepId": "s-23PUT0NR3XF6O"}, {"Reason": "Cannot cancel the step. It is already CANCELLED.", "Status": "FAILED", "StepId": "s-2NUYMUZ3ADACC"}, {"Reason": "Cannot cancel the step. It is already RUNNING.", "Status": "FAILED", "StepId": "s-10O5XO5JUY9OE"}, {"Reason": "Cannot cancel the step. It is already FAILED.", "Status": "FAILED", "StepId": "s-CS88G2XK4N7X"}, {"Reason": "", "Status": "SUBMITTED", "StepId": "s-2M366D3KU4OTZ"} ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: