Skip to content

update_model_package async

update_model_package(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_package_arn: Optional[ModelPackageArn] = None,
    model_approval_status: Optional[ModelApprovalStatus] = None,
    model_package_registration_type: Optional[ModelPackageRegistrationType] = None,
    approval_description: Optional[ApprovalDescription] = None,
    customer_metadata_properties: Optional[CustomerMetadataMap] = None,
    customer_metadata_properties_to_remove: Optional[CustomerMetadataKeyList] = None,
    additional_inference_specifications_to_add: Optional[
        AdditionalInferenceSpecifications
    ] = None,
    inference_specification: Optional[InferenceSpecification] = None,
    source_uri: Optional[ModelPackageSourceUri] = None,
    model_card: Optional[ModelPackageModelCard] = None,
    model_life_cycle: Optional[ModelLifeCycle] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateModelPackageOutput

Updates a versioned model.

Parameters:

  • model_package_arn (Optional[ModelPackageArn], default: None ) –

    The Amazon Resource Name (ARN) of the model package.

  • model_approval_status (Optional[ModelApprovalStatus], default: None ) –

    The approval status of the model.

  • model_package_registration_type (Optional[ModelPackageRegistrationType], default: None ) –

    The package registration type of the model package input.

  • approval_description (Optional[ApprovalDescription], default: None ) –

    A description for the approval status of the model.

  • customer_metadata_properties (Optional[CustomerMetadataMap], default: None ) –

    The metadata properties associated with the model package versions.

  • customer_metadata_properties_to_remove (Optional[CustomerMetadataKeyList], default: None ) –

    The metadata properties associated with the model package versions to remove.

  • additional_inference_specifications_to_add (Optional[AdditionalInferenceSpecifications], default: None ) –

    An array of additional Inference Specification objects to be added to the existing array additional Inference Specification. Total number of additional Inference Specifications can not exceed 15. Each additional Inference Specification specifies artifacts based on this model package that can be used on inference endpoints. Generally used with SageMaker Neo to store the compiled artifacts.

  • inference_specification (Optional[InferenceSpecification], default: None ) –

    Specifies details about inference jobs that you can run with models based on this model package, including the following information:

    • The Amazon ECR paths of containers that contain the inference code and model artifacts.

    • The instance types that the model package supports for transform jobs and real-time endpoints used for inference.

    • The input and output content formats that the model package supports for inference.

  • source_uri (Optional[ModelPackageSourceUri], default: None ) –

    The URI of the source for the model package.

  • model_card (Optional[ModelPackageModelCard], default: None ) –

    The model card associated with the model package. Since ModelPackageModelCard is tied to a model package, it is a specific usage of a model card and its schema is simplified compared to the schema of ModelCard. The ModelPackageModelCard schema does not include model_package_details, and model_overview is composed of the model_creator and model_artifact properties. For more information about the model package model card schema, see Model package model card schema. For more information about the model card associated with the model package, see View the Details of a Model Version.

  • model_life_cycle (Optional[ModelLifeCycle], default: None ) –

    A structure describing the current state of the model in its life cycle.

  • client_token (Optional[ClientToken], default: None ) –

    A unique token that guarantees that the call to this API is idempotent.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • UnknownServiceError –

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

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def update_model_package(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_package_arn: Optional[
        "capo_sagemaker.types.model_package_arn.ModelPackageArn"
    ] = None,
    model_approval_status: Optional[
        "capo_sagemaker.types.model_approval_status.ModelApprovalStatus"
    ] = None,
    model_package_registration_type: Optional[
        "capo_sagemaker.types.model_package_registration_type.ModelPackageRegistrationType"
    ] = None,
    approval_description: Optional[
        "capo_sagemaker.types.approval_description.ApprovalDescription"
    ] = None,
    customer_metadata_properties: Optional[
        "capo_sagemaker.types.customer_metadata_map.CustomerMetadataMap"
    ] = None,
    customer_metadata_properties_to_remove: Optional[
        "capo_sagemaker.types.customer_metadata_key_list.CustomerMetadataKeyList"
    ] = None,
    additional_inference_specifications_to_add: Optional[
        "capo_sagemaker.types.additional_inference_specifications.AdditionalInferenceSpecifications"
    ] = None,
    inference_specification: Optional[
        "capo_sagemaker.types.inference_specification.InferenceSpecification"
    ] = None,
    source_uri: Optional[
        "capo_sagemaker.types.model_package_source_uri.ModelPackageSourceUri"
    ] = None,
    model_card: Optional[
        "capo_sagemaker.types.model_package_model_card.ModelPackageModelCard"
    ] = None,
    model_life_cycle: Optional[
        "capo_sagemaker.types.model_life_cycle.ModelLifeCycle"
    ] = None,
    client_token: Optional["capo_sagemaker.types.client_token.ClientToken"] = None,
) -> "capo_sagemaker.types.update_model_package_output.UpdateModelPackageOutput":
    """<p>Updates a versioned model.</p>

    Args:
        model_package_arn: <p>The Amazon Resource Name (ARN) of the model package.</p>
        model_approval_status: <p>The approval status of the model.</p>
        model_package_registration_type: <p> The package registration type of the model package input. </p>
        approval_description: <p>A description for the approval status of the model.</p>
        customer_metadata_properties: <p>The metadata properties associated with the model package versions.</p>
        customer_metadata_properties_to_remove: <p>The metadata properties associated with the model package versions to remove.</p>
        additional_inference_specifications_to_add: <p>An array of additional Inference Specification objects to be added to the existing array additional Inference Specification. Total number of additional Inference Specifications can not exceed 15. Each additional Inference Specification specifies artifacts based on this model package that can be used on inference endpoints. Generally used with SageMaker Neo to store the compiled artifacts.</p>
        inference_specification: <p>Specifies details about inference jobs that you can run with models based on this model package, including the following information:</p> <ul> <li> <p>The Amazon ECR paths of containers that contain the inference code and model artifacts.</p> </li> <li> <p>The instance types that the model package supports for transform jobs and real-time endpoints used for inference.</p> </li> <li> <p>The input and output content formats that the model package supports for inference.</p> </li> </ul>
        source_uri: <p>The URI of the source for the model package.</p>
        model_card: <p>The model card associated with the model package. Since <code>ModelPackageModelCard</code> is tied to a model package, it is a specific usage of a model card and its schema is simplified compared to the schema of <code>ModelCard</code>. The <code>ModelPackageModelCard</code> schema does not include <code>model_package_details</code>, and <code>model_overview</code> is composed of the <code>model_creator</code> and <code>model_artifact</code> properties. For more information about the model package model card schema, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-registry-details.html#model-card-schema">Model package model card schema</a>. For more information about the model card associated with the model package, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-registry-details.html">View the Details of a Model Version</a>.</p>
        model_life_cycle: <p> A structure describing the current state of the model in its life cycle. </p>
        client_token: <p> A unique token that guarantees that the call to this API is idempotent. </p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.update_model_package_input.UpdateModelPackageInput]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.update_model_package_output.UpdateModelPackageOutput"
    ]:
        import capo_sagemaker._operations.sage_maker.update_model_package

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.update_model_package.async_update_model_package(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sagemaker.types.update_model_package_input.UpdateModelPackageInput",
    ) -> dict[str, Any]:
        import capo_sagemaker.types.update_model_package_input

        return capo_sagemaker.types.update_model_package_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateModelPackage", redact_input=_redact_input),
    )
    input_: capo_sagemaker.types.update_model_package_input.UpdateModelPackageInput = {}
    if model_package_arn is not None:
        input_["model_package_arn"] = model_package_arn
    if model_approval_status is not None:
        input_["model_approval_status"] = model_approval_status
    if model_package_registration_type is not None:
        input_["model_package_registration_type"] = model_package_registration_type
    if approval_description is not None:
        input_["approval_description"] = approval_description
    if customer_metadata_properties is not None:
        input_["customer_metadata_properties"] = customer_metadata_properties
    if customer_metadata_properties_to_remove is not None:
        input_["customer_metadata_properties_to_remove"] = (
            customer_metadata_properties_to_remove
        )
    if additional_inference_specifications_to_add is not None:
        input_["additional_inference_specifications_to_add"] = (
            additional_inference_specifications_to_add
        )
    if inference_specification is not None:
        input_["inference_specification"] = inference_specification
    if source_uri is not None:
        input_["source_uri"] = source_uri
    if model_card is not None:
        input_["model_card"] = model_card
    if model_life_cycle is not None:
        input_["model_life_cycle"] = model_life_cycle
    if client_token is not None:
        input_["client_token"] = client_token

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