:doc:`SnowDeviceManagement <../../snow-device-management>` / Client / cancel_task

***********
cancel_task
***********



.. py:method:: SnowDeviceManagement.Client.cancel_task(**kwargs)

  

  Sends a cancel request for a specified task. You can cancel a task only if it's still in a ``QUEUED`` state. Tasks that are already running can't be cancelled.

   

  .. note::

    

    A task might still run if it's processed from the queue before the ``CancelTask`` operation changes the task's state.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/snow-device-management-2021-08-04/CancelTask>`_  


  **Request Syntax**
  ::

    response = client.cancel_task(
        taskId='string'
    )
    
  :type taskId: string
  :param taskId: **[REQUIRED]** 

    The ID of the task that you are attempting to cancel. You can retrieve a task ID by using the ``ListTasks`` operation.

    

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

    
    ::

      {
          'taskId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **taskId** *(string) --* 

        The ID of the task that you are attempting to cancel.

        
  
  **Exceptions**
  
  *   :py:class:`SnowDeviceManagement.Client.exceptions.ThrottlingException`

  
  *   :py:class:`SnowDeviceManagement.Client.exceptions.InternalServerException`

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

  
  *   :py:class:`SnowDeviceManagement.Client.exceptions.ValidationException`

  
  *   :py:class:`SnowDeviceManagement.Client.exceptions.AccessDeniedException`

  