Skip to content

start_document_classification_job async

start_document_classification_job(
    input_data_config: InputDataConfig,
    output_data_config: OutputDataConfig,
    data_access_role_arn: IamRoleArn,
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    job_name: Optional[JobName] = None,
    document_classifier_arn: Optional[DocumentClassifierArn] = None,
    client_request_token: Optional[ClientRequestTokenString] = None,
    volume_kms_key_id: Optional[KmsKeyId] = None,
    vpc_config: Optional[VpcConfig] = None,
    tags: Optional[TagList] = None,
    flywheel_arn: Optional[ComprehendFlywheelArn] = None,
) -> StartDocumentClassificationJobResponse

Starts an asynchronous document classification job using a custom classification model. Use the DescribeDocumentClassificationJob operation to track the progress of the job.

Parameters:

  • job_name (Optional[JobName], default: None ) –

    The identifier of the job.

  • document_classifier_arn (Optional[DocumentClassifierArn], default: None ) –

    The Amazon Resource Name (ARN) of the document classifier to use to process the job.

  • input_data_config (InputDataConfig) –

    Specifies the format and location of the input data for the job.

  • output_data_config (OutputDataConfig) –

    Specifies where to send the output files.

  • data_access_role_arn (IamRoleArn) –

    The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.

  • client_request_token (Optional[ClientRequestTokenString], default: None ) –

    A unique identifier for the request. If you do not set the client request token, Amazon Comprehend generates one.

  • volume_kms_key_id (Optional[KmsKeyId], default: None ) –

    ID for the Amazon Web Services Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats:

    • KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab"

    • Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"

  • vpc_config (Optional[VpcConfig], default: None ) –

    Configuration parameters for an optional private Virtual Private Cloud (VPC) containing the resources you are using for your document classification job. For more information, see Amazon VPC.

  • tags (Optional[TagList], default: None ) –

    Tags to associate with the document classification job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.

  • flywheel_arn (Optional[ComprehendFlywheelArn], default: None ) –

    The Amazon Resource Number (ARN) of the flywheel associated with the model to use.

Raises:

Source code in docs_src/capo_comprehend/_services/async_comprehend.py
async def start_document_classification_job(
    self,
    input_data_config: "capo_comprehend.types.input_data_config.InputDataConfig",
    output_data_config: "capo_comprehend.types.output_data_config.OutputDataConfig",
    data_access_role_arn: "capo_comprehend.types.iam_role_arn.IamRoleArn",
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    job_name: Optional["capo_comprehend.types.job_name.JobName"] = None,
    document_classifier_arn: Optional[
        "capo_comprehend.types.document_classifier_arn.DocumentClassifierArn"
    ] = None,
    client_request_token: Optional[
        "capo_comprehend.types.client_request_token_string.ClientRequestTokenString"
    ] = None,
    volume_kms_key_id: Optional["capo_comprehend.types.kms_key_id.KmsKeyId"] = None,
    vpc_config: Optional["capo_comprehend.types.vpc_config.VpcConfig"] = None,
    tags: Optional["capo_comprehend.types.tag_list.TagList"] = None,
    flywheel_arn: Optional[
        "capo_comprehend.types.comprehend_flywheel_arn.ComprehendFlywheelArn"
    ] = None,
) -> "capo_comprehend.types.start_document_classification_job_response.StartDocumentClassificationJobResponse":
    """<p>Starts an asynchronous document classification job using a custom classification model. Use the <code>DescribeDocumentClassificationJob</code> operation to track the progress of the job.</p>

    Args:
        job_name: <p>The identifier of the job.</p>
        document_classifier_arn: <p>The Amazon Resource Name (ARN) of the document classifier to use to process the job.</p>
        input_data_config: <p>Specifies the format and location of the input data for the job.</p>
        output_data_config: <p>Specifies where to send the output files.</p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.</p>
        client_request_token: <p>A unique identifier for the request. If you do not set the client request token, Amazon Comprehend generates one.</p>
        volume_kms_key_id: <p>ID for the Amazon Web Services Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats:</p> <ul> <li> <p>KMS Key ID: <code>"1234abcd-12ab-34cd-56ef-1234567890ab"</code> </p> </li> <li> <p>Amazon Resource Name (ARN) of a KMS Key: <code>"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"</code> </p> </li> </ul>
        vpc_config: <p>Configuration parameters for an optional private Virtual Private Cloud (VPC) containing the resources you are using for your document classification job. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html">Amazon VPC</a>. </p>
        tags: <p>Tags to associate with the document classification job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.</p>
        flywheel_arn: <p>The Amazon Resource Number (ARN) of the flywheel associated with the model to use.</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.kms_key_validation_exception.KmsKeyValidationException: <p>The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.</p>
        capo_comprehend.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource name is already in use. Use a different name and try your request again.</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.resource_unavailable_exception.ResourceUnavailableException: <p>The specified resource is not available. Check the resource 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.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_comprehend.types.start_document_classification_job_request.StartDocumentClassificationJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_comprehend.types.start_document_classification_job_response.StartDocumentClassificationJobResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.start_document_classification_job

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartDocumentClassificationJob")
    )
    input_: capo_comprehend.types.start_document_classification_job_request.StartDocumentClassificationJobRequest = {
        "input_data_config": input_data_config,
        "output_data_config": output_data_config,
        "data_access_role_arn": data_access_role_arn,
    }
    if job_name is not None:
        input_["job_name"] = job_name
    if document_classifier_arn is not None:
        input_["document_classifier_arn"] = document_classifier_arn
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if volume_kms_key_id is not None:
        input_["volume_kms_key_id"] = volume_kms_key_id
    if vpc_config is not None:
        input_["vpc_config"] = vpc_config
    if tags is not None:
        input_["tags"] = tags
    if flywheel_arn is not None:
        input_["flywheel_arn"] = flywheel_arn

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