Canceling steps - Amazon EMR
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).

Canceling steps

You can cancel pending and running steps from the Amazon Web Services Management Console, the Amazon CLI, or the Amazon EMR API.

Note

We’ve redesigned the Amazon EMR console to make it easier to use. See Amazon EMR console to learn about the differences between the old and new console experiences.

New console
To cancel steps with the new console
  1. Sign in to the Amazon Web Services Management Console, and open the Amazon EMR console at https://console.amazonaws.cn/emr.

  2. Under EMR on EC2 in the left navigation pane, choose Clusters, and then select the cluster that you want to update.

  3. 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.

  4. 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.

  5. The status of the steps in the Steps table changes to CANCELLED.

Old console
To cancel steps with the old console
  1. Navigate to the new Amazon EMR console and select Switch to the old console from the side navigation. For more information on what to expect when you switch to the old console, see Using the old console.

  2. On the Cluster Details page, expand the Steps section.

  3. For each step you want to cancel, select the step from the list of Steps. Then choose Cancel step.

  4. In the Cancel step dialog, keep the default option Cancel the step and wait for it to exit. If you want to end the step immediately without waiting for any processes to complete, choose Cancel the step and force it to exit.

  5. Choose Cancel step.

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.