Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Cancel steps when you submit work to an Amazon EMR cluster
You can cancel pending and running steps from the Amazon Web Services Management Console, the Amazon CLI, or the Amazon EMR, when you submit work to your cluster.
API.
- Console
-
To cancel steps with the console
-
Sign in to the Amazon Web Services Management Console, and open the Amazon EMR console at
https://console.amazonaws.cn/emr.
-
Under EMR on EC2 in the left navigation pane,
choose Clusters, and then select the cluster
that you want to update.
-
On the Steps tab on the cluster details page,
select the check box next to the step you wants to cancel. Choose
the Actions dropdown menu and then select
Cancel steps.
-
In the Cancel the step dialog, choose to
either cancel the step and wait for it to exit, or cancel the step
and force it to exit. Then choose
Confirm.
-
The status of the steps in the Steps table
changes to CANCELLED
.
- CLI
-
To cancel with using the Amazon CLI
-
Use the aws emr cancel-steps
command, specifying the
cluster and steps to cancel. The following example demonstrates an
Amazon CLI command to cancel two steps.
aws emr cancel-steps --cluster-id j-2QUAXXXXXXXXX
\
--step-ids s-3M8DXXXXXXXXX s-3M8DXXXXXXXXX
\
--step-cancellation-option SEND_INTERRUPT
With Amazon EMR version 5.28.0, you can choose one of the two following
cancellation options for StepCancellationOption
parameter when
canceling steps.
-
SEND_INTERRUPT
– This is the default option.
When a step cancellation request is received, EMR sends a
SIGTERM
signal to the step. add a
SIGTERM
signal handler to your step logic to catch
this signal and terminate descendant step processes or wait for them
to complete.
-
TERMINATE_PROCESS
– When this option is
selected, EMR sends a SIGKILL
signal to the step and
all its descendant processes which terminates them
immediately.
Considerations for canceling steps
-
Canceling a running or pending step removes that step from the active step
count.
-
Canceling a running step does not allow a pending step to start running,
assuming no change to stepConcurrencyLevel
.
-
Canceling a running step does not trigger the step
ActionOnFailure
.
-
For EMR 5.32.0 and later, SEND_INTERRUPT StepCancellationOption
sends a SIGTERM
signal to the step child process. You should watch
for this signal and do a cleanup and shutdown gracefully. The
TERMINATE_PROCESS StepCancellationOption
sends a
SIGKILL
signal to the step child process and all of its
descendant processes; however, asynchronous processes are not affected.