:doc:`IoT <../../iot>` / Client / cancel_job

**********
cancel_job
**********



.. py:method:: IoT.Client.cancel_job(**kwargs)

  

  Cancels a job.

   

  Requires permission to access the `CancelJob <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/CancelJob>`_  


  **Request Syntax**
  ::

    response = client.cancel_job(
        jobId='string',
        reasonCode='string',
        comment='string',
        force=True|False
    )
    
  :type jobId: string
  :param jobId: **[REQUIRED]** 

    The unique identifier you assigned to this job when it was created.

    

  
  :type reasonCode: string
  :param reasonCode: 

    (Optional)A reason code string that explains why the job was canceled.

    

  
  :type comment: string
  :param comment: 

    An optional comment string describing why the job was canceled.

    

  
  :type force: boolean
  :param force: 

    (Optional) If ``true`` job executions with status "IN_PROGRESS" and "QUEUED" are canceled, otherwise only job executions with status "QUEUED" are canceled. The default is ``false``.

     

    Canceling a job which is "IN_PROGRESS", will cause a device which is executing the job to be unable to update the job execution status. Use caution and ensure that each device executing a job which is canceled is able to recover to a valid state.

    

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

    
    ::

      {
          'jobArn': 'string',
          'jobId': 'string',
          'description': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **jobArn** *(string) --* 

        The job ARN.

        
      

      - **jobId** *(string) --* 

        The unique identifier you assigned to this job when it was created.

        
      

      - **description** *(string) --* 

        A short text description of the job.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.LimitExceededException`

  