:doc:`EMR <../../emr>` / Client / cancel_steps

************
cancel_steps
************



.. py:method:: EMR.Client.cancel_steps(**kwargs)

  

  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.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CancelSteps>`_  


  **Request Syntax**
  ::

    response = client.cancel_steps(
        ClusterId='string',
        StepIds=[
            'string',
        ],
        StepCancellationOption='SEND_INTERRUPT'|'TERMINATE_PROCESS'
    )
    
  :type ClusterId: string
  :param ClusterId: **[REQUIRED]** 

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

    

  
  :type StepIds: list
  :param StepIds: **[REQUIRED]** 

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

    

  
    - *(string) --* 

    

  :type StepCancellationOption: string
  :param StepCancellationOption: 

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

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'CancelStepsInfoList': [
              {
                  'StepId': 'string',
                  'Status': 'SUBMITTED'|'FAILED',
                  'Reason': 'string'
              },
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 

      The output for the  CancelSteps operation.

      
      

      - **CancelStepsInfoList** *(list) --* 

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

        
        

        - *(dict) --* 

          Specification of the status of a CancelSteps request. Available only in Amazon EMR version 4.8.0 and later, excluding version 5.0.0.

          
          

          - **StepId** *(string) --* 

            The encrypted StepId of a step.

            
          

          - **Status** *(string) --* 

            The status of a CancelSteps Request. The value may be SUBMITTED or FAILED.

            
          

          - **Reason** *(string) --* 

            The reason for the failure if the CancelSteps request fails.

            
      
    
  
  **Exceptions**
  
  *   :py:class:`EMR.Client.exceptions.InternalServerError`

  
  *   :py:class:`EMR.Client.exceptions.InvalidRequestException`

  