Batch / Client / terminate_jobs
terminate_jobs¶
- Batch.Client.terminate_jobs(**kwargs)¶
Terminates up to 50 jobs in a job queue. This is a bulk version of TerminateJob. Jobs that are in the
STARTINGorRUNNINGstate are terminated, which causes them to transition toFAILED. Jobs that have not progressed to theSTARTINGstate are cancelled.Batch reports the result for each job individually in the response. Jobs that were processed successfully are reported in the
successfullist. Jobs that encountered errors are reported in theerrorslist. The response returns an HTTP status code of200even when some jobs encountered errors, so check theerrorslist. Jobs that can’t be found are treated as successfully processed.See also: AWS API Documentation
Request Syntax
response = client.terminate_jobs( jobs=[ 'string', ], reason='string' )
- Parameters:
jobs (list) –
[REQUIRED]
An array of up to 50 Batch job IDs of the jobs to terminate.
(string) –
reason (string) –
[REQUIRED]
A message to attach to the job that explains the reason for terminating it. This message is returned by future DescribeJobs operations on the job. It is also recorded in the Batch activity logs.
This parameter has a limit of 1024 characters.
- Return type:
dict
- Returns:
Response Syntax
{ 'successful': [ 'string', ], 'errors': [ { 'job': 'string', 'code': 'string', 'message': 'string' }, ] }
Response Structure
(dict) –
The result of a
TerminateJobsrequest, including the jobs whose termination request was accepted and the errors for jobs that couldn’t be terminated.successful (list) –
A list of the job IDs whose termination request was accepted.
(string) –
errors (list) –
A list of
TerminateJobsErrorDetailitems, one for each job that couldn’t be terminated. Each item includes the job ID along with a code and message that describe why the job wasn’t terminated.(dict) –
An object that contains the details of a job that couldn’t be terminated by a
TerminateJobsoperation.job (string) –
The Batch job ID of the job that couldn’t be terminated.
code (string) –
An error code that identifies the reason the job couldn’t be terminated. Valid values are:
ValidationException– A job identifier in the request is malformed or isn’t valid.ClientException– The request failed because of a client error.ThrottlingException– The request was throttled. Retry the request.ServerException– An internal error occurred. Retry the request.AccessDenied– The caller isn’t authorized to perform the action on the specified job.
message (string) –
A message that describes the reason the job couldn’t be terminated.
Exceptions
Batch.Client.exceptions.ClientExceptionBatch.Client.exceptions.ServerException