Batch / Client / terminate_service_jobs

terminate_service_jobs

Batch.Client.terminate_service_jobs(**kwargs)

Terminates up to 50 service jobs in a job queue. This is a bulk version of TerminateServiceJob.

Batch reports the result for each service job individually in the response. Service jobs that were processed successfully are reported in the successful list. Service jobs that encountered errors are reported in the errors list. The response returns an HTTP status code of 200 even when some service jobs encountered errors, so check the errors list. Service jobs that can’t be found are treated as successfully processed.

See also: AWS API Documentation

Request Syntax

response = client.terminate_service_jobs(
    jobs=[
        'string',
    ],
    reason='string'
)
Parameters:
  • jobs (list) –

    [REQUIRED]

    An array of up to 50 service job IDs of the service jobs to terminate.

    • (string) –

  • reason (string) –

    [REQUIRED]

    A message to attach to the service job that explains the reason for terminating it. This message is returned by DescribeServiceJob operations on the service job.

Return type:

dict

Returns:

Response Syntax

{
    'successful': [
        'string',
    ],
    'errors': [
        {
            'job': 'string',
            'code': 'string',
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    The result of a TerminateServiceJobs request, including the service jobs whose termination request was accepted and the errors for service jobs that couldn’t be terminated.

    • successful (list) –

      A list of the service job IDs whose termination request was accepted.

      • (string) –

    • errors (list) –

      A list of TerminateServiceJobsErrorDetail items, one for each service job that couldn’t be terminated. Each item includes the service job ID along with a code and message that describe why the service job wasn’t terminated.

      • (dict) –

        An object that contains the details of a service job that couldn’t be terminated by a TerminateServiceJobs operation.

        • job (string) –

          The service job ID of the service job that couldn’t be terminated.

        • code (string) –

          An error code that identifies the reason the service job couldn’t be terminated. Valid values are:

          • ValidationException – A service 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 service job.

        • message (string) –

          A message that describes the reason the service job couldn’t be terminated.

Exceptions

  • Batch.Client.exceptions.ClientException

  • Batch.Client.exceptions.ServerException