Skip to content

terminate_service_job

terminate_service_job(
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    job_id: Optional[String] = None,
    reason: Optional[String] = None,
) -> TerminateServiceJobResponse

Terminates a service job in a job queue.

Parameters:

  • job_id (Optional[String], default: None ) –

    The service job ID of the service job to terminate.

  • reason (Optional[String], default: None ) –

    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.

Raises:

  • ClientException –

    These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_batch/_services/batch.py
def terminate_service_job(
    self,
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    job_id: Optional["capo_batch.types.string.String"] = None,
    reason: Optional["capo_batch.types.string.String"] = None,
) -> "capo_batch.types.terminate_service_job_response.TerminateServiceJobResponse":
    """<p>Terminates a service job in a job queue. </p>

    Args:
        job_id: <p>The service job ID of the service job to terminate.</p>
        reason: <p>A message to attach to the service job that explains the reason for terminating it. This message is returned by <code>DescribeServiceJob</code> operations on the service job.</p>

    Raises:
        capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
        capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_batch.types.terminate_service_job_request.TerminateServiceJobRequest]",
    ) -> OperationResponse[
        "capo_batch.types.terminate_service_job_response.TerminateServiceJobResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.terminate_service_job

        output, http_response = (
            capo_batch._operations.aws_batch_v20160810.terminate_service_job.terminate_service_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TerminateServiceJob")
    )
    input_: capo_batch.types.terminate_service_job_request.TerminateServiceJobRequest = {}
    if job_id is not None:
        input_["job_id"] = job_id
    if reason is not None:
        input_["reason"] = reason

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output