Skip to content

import_model_version

import_model_version(
    source_model_version_arn: ModelVersionArn,
    dataset_name: DatasetIdentifier,
    client_token: IdempotenceToken,
    *,
    config_overrides: Optional[LookoutEquipmentClientConfig] = None,
    model_name: Optional[ModelName] = None,
    labels_input_configuration: Optional[LabelsInputConfiguration] = None,
    role_arn: Optional[IamRoleArn] = None,
    server_side_kms_key_id: Optional[NameOrArn] = None,
    tags: Optional[TagList] = None,
    inference_data_import_strategy: Optional[InferenceDataImportStrategy] = None,
) -> ImportModelVersionResponse

Imports a model that has been trained successfully.

Parameters:

  • source_model_version_arn (ModelVersionArn) –

    The Amazon Resource Name (ARN) of the model version to import.

  • model_name (Optional[ModelName], default: None ) –

    The name for the machine learning model to be created. If the model already exists, Amazon Lookout for Equipment creates a new version. If you do not specify this field, it is filled with the name of the source model.

  • dataset_name (DatasetIdentifier) –

    The name of the dataset for the machine learning model being imported.

  • client_token (IdempotenceToken) –

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

  • role_arn (Optional[IamRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of a role with permission to access the data source being used to create the machine learning model.

  • server_side_kms_key_id (Optional[NameOrArn], default: None ) –

    Provides the identifier of the KMS key key used to encrypt model data by Amazon Lookout for Equipment.

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

    The tags associated with the machine learning model to be created.

  • inference_data_import_strategy (Optional[InferenceDataImportStrategy], default: None ) –

    Indicates how to import the accumulated inference data when a model version is imported. The possible values are as follows:

    • NO_IMPORT – Don't import the data.

    • ADD_WHEN_EMPTY – Only import the data from the source model if there is no existing data in the target model.

    • OVERWRITE – Import the data from the source model and overwrite the existing data in the target model.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have access to the resource.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the target resource.

  • InternalServerException –

    Processing of the request has failed because of an unknown error, exception or failure.

  • ResourceNotFoundException –

    The resource requested could not be found. Verify the resource ID and retry your request.

  • ServiceQuotaExceededException –

    Resource limitations have been exceeded.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized.

  • UnknownServiceError –

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

Source code in docs_src/capo_lookoutequipment/_services/lookout_equipment.py
def import_model_version(
    self,
    source_model_version_arn: "capo_lookoutequipment.types.model_version_arn.ModelVersionArn",
    dataset_name: "capo_lookoutequipment.types.dataset_identifier.DatasetIdentifier",
    client_token: "capo_lookoutequipment.types.idempotence_token.IdempotenceToken",
    *,
    config_overrides: Optional[LookoutEquipmentClientConfig] = None,
    model_name: Optional["capo_lookoutequipment.types.model_name.ModelName"] = None,
    labels_input_configuration: Optional[
        "capo_lookoutequipment.types.labels_input_configuration.LabelsInputConfiguration"
    ] = None,
    role_arn: Optional[
        "capo_lookoutequipment.types.iam_role_arn.IamRoleArn"
    ] = None,
    server_side_kms_key_id: Optional[
        "capo_lookoutequipment.types.name_or_arn.NameOrArn"
    ] = None,
    tags: Optional["capo_lookoutequipment.types.tag_list.TagList"] = None,
    inference_data_import_strategy: Optional[
        "capo_lookoutequipment.types.inference_data_import_strategy.InferenceDataImportStrategy"
    ] = None,
) -> "capo_lookoutequipment.types.import_model_version_response.ImportModelVersionResponse":
    """<p>Imports a model that has been trained successfully.</p>

    Args:
        source_model_version_arn: <p>The Amazon Resource Name (ARN) of the model version to import.</p>
        model_name: <p>The name for the machine learning model to be created. If the model already exists, Amazon Lookout for Equipment creates a new version. If you do not specify this field, it is filled with the name of the source model.</p>
        dataset_name: <p>The name of the dataset for the machine learning model being imported. </p>
        client_token: <p>A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one. </p>
        role_arn: <p>The Amazon Resource Name (ARN) of a role with permission to access the data source being used to create the machine learning model. </p>
        server_side_kms_key_id: <p>Provides the identifier of the KMS key key used to encrypt model data by Amazon Lookout for Equipment. </p>
        tags: <p>The tags associated with the machine learning model to be created. </p>
        inference_data_import_strategy: <p>Indicates how to import the accumulated inference data when a model version is imported. The possible values are as follows:</p> <ul> <li> <p>NO_IMPORT – Don't import the data.</p> </li> <li> <p>ADD_WHEN_EMPTY – Only import the data from the source model if there is no existing data in the target model.</p> </li> <li> <p>OVERWRITE – Import the data from the source model and overwrite the existing data in the target model.</p> </li> </ul>

    Raises:
        capo_lookoutequipment.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have access to the resource. </p>
        capo_lookoutequipment.errors.conflict_exception.ConflictException: <p> The request could not be completed due to a conflict with the current state of the target resource. </p>
        capo_lookoutequipment.errors.internal_server_exception.InternalServerException: <p> Processing of the request has failed because of an unknown error, exception or failure. </p>
        capo_lookoutequipment.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource requested could not be found. Verify the resource ID and retry your request. </p>
        capo_lookoutequipment.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> Resource limitations have been exceeded. </p>
        capo_lookoutequipment.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_lookoutequipment.errors.validation_exception.ValidationException: <p> The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized. </p>
        capo_lookoutequipment.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lookoutequipment.types.import_model_version_request.ImportModelVersionRequest]",
    ) -> OperationResponse[
        "capo_lookoutequipment.types.import_model_version_response.ImportModelVersionResponse"
    ]:
        import capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.import_model_version

        output, http_response = (
            capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.import_model_version.import_model_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ImportModelVersion")
    )
    input_: capo_lookoutequipment.types.import_model_version_request.ImportModelVersionRequest = {
        "source_model_version_arn": source_model_version_arn,
        "dataset_name": dataset_name,
        "client_token": client_token,
    }
    if model_name is not None:
        input_["model_name"] = model_name
    if labels_input_configuration is not None:
        input_["labels_input_configuration"] = labels_input_configuration
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if server_side_kms_key_id is not None:
        input_["server_side_kms_key_id"] = server_side_kms_key_id
    if tags is not None:
        input_["tags"] = tags
    if inference_data_import_strategy is not None:
        input_["inference_data_import_strategy"] = inference_data_import_strategy

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