:doc:`Batch <../../batch>` / Client / terminate_job

*************
terminate_job
*************



.. py:method:: Batch.Client.terminate_job(**kwargs)

  

  Terminates a job in a job queue. Jobs that are in the ``STARTING`` or ``RUNNING`` state are terminated, which causes them to transition to ``FAILED``. Jobs that have not progressed to the ``STARTING`` state are cancelled.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/TerminateJob>`_  


  **Request Syntax**
  ::

    response = client.terminate_job(
        jobId='string',
        reason='string'
    )
    
  :type jobId: string
  :param jobId: **[REQUIRED]** 

    The Batch job ID of the job to terminate.

    

  
  :type reason: string
  :param reason: **[REQUIRED]** 

    A message to attach to the job that explains the reason for canceling it. This message is returned by future  DescribeJobs operations on the job. It is also recorded in the Batch activity logs.

     

    This parameter has as limit of 1024 characters.

    

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

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`Batch.Client.exceptions.ClientException`

  
  *   :py:class:`Batch.Client.exceptions.ServerException`

  

  **Examples**

  This example terminates a job with the specified job ID.
  ::

    response = client.terminate_job(
        jobId='61e743ed-35e4-48da-b2de-5c8333821c84',
        reason='Terminating job.',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  