Skip to content

stop_training_document_classifier async

stop_training_document_classifier(
    document_classifier_arn: DocumentClassifierArn,
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
) -> StopTrainingDocumentClassifierResponse

Stops a document classifier training job while in progress.

If the training job state is TRAINING, the job is marked for termination and put into the STOP_REQUESTED state. If the training job completes before it can be stopped, it is put into the TRAINED; otherwise the training job is stopped and put into the STOPPED state and the service sends back an HTTP 200 response with an empty HTTP body.

Parameters:

  • document_classifier_arn (DocumentClassifierArn) –

    The Amazon Resource Name (ARN) that identifies the document classifier currently being trained.

Raises:

Source code in docs_src/capo_comprehend/_services/async_comprehend.py
async def stop_training_document_classifier(
    self,
    document_classifier_arn: "capo_comprehend.types.document_classifier_arn.DocumentClassifierArn",
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
) -> "capo_comprehend.types.stop_training_document_classifier_response.StopTrainingDocumentClassifierResponse":
    """<p>Stops a document classifier training job while in progress.</p> <p>If the training job state is <code>TRAINING</code>, the job is marked for termination and put into the <code>STOP_REQUESTED</code> state. If the training job completes before it can be stopped, it is put into the <code>TRAINED</code>; otherwise the training job is stopped and put into the <code>STOPPED</code> state and the service sends back an HTTP 200 response with an empty HTTP body. </p>

    Args:
        document_classifier_arn: <p>The Amazon Resource Name (ARN) that identifies the document classifier currently being trained.</p>

    Raises:
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
        capo_comprehend.errors.too_many_requests_exception.TooManyRequestsException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_comprehend.types.stop_training_document_classifier_request.StopTrainingDocumentClassifierRequest]",
    ) -> AsyncOperationResponse[
        "capo_comprehend.types.stop_training_document_classifier_response.StopTrainingDocumentClassifierResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.stop_training_document_classifier

        (
            output,
            http_response,
        ) = await capo_comprehend._operations.comprehend_20171127.stop_training_document_classifier.async_stop_training_document_classifier(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopTrainingDocumentClassifier")
    )
    input_: capo_comprehend.types.stop_training_document_classifier_request.StopTrainingDocumentClassifierRequest = {
        "document_classifier_arn": document_classifier_arn
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output