terminate_job

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

Request Syntax

response = client.terminate_job(
    jobId='string',
    reason='string'
)
Parameters
  • jobId (string) --

    [REQUIRED]

    The Batch job ID of the job to terminate.

  • reason (string) --

    [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. This message is also recorded in the Batch activity logs.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • Batch.Client.exceptions.ClientException
  • 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': {
        '...': '...',
    },
}