Skip to content

delete_model

delete_model(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    model_name: Optional[ModelName] = None,
) -> None

Deletes a model. The DeleteModel API deletes only the model entry that was created in SageMaker when you called the CreateModel API. It does not delete model artifacts, inference code, or the IAM role that you specified when creating the model.

Parameters:

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

    The name of the model to delete.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def delete_model(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    model_name: Optional["capo_sagemaker.types.model_name.ModelName"] = None,
) -> None:
    """<p>Deletes a model. The <code>DeleteModel</code> API deletes only the model entry that was created in SageMaker when you called the <code>CreateModel</code> API. It does not delete model artifacts, inference code, or the IAM role that you specified when creating the model. </p>

    Args:
        model_name: <p>The name of the model to delete.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.delete_model_input.DeleteModelInput]",
    ) -> OperationResponse[None]:
        import capo_sagemaker._operations.sage_maker.delete_model

        output, http_response = (
            capo_sagemaker._operations.sage_maker.delete_model.delete_model(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteModel")
    )
    input_: capo_sagemaker.types.delete_model_input.DeleteModelInput = {}
    if model_name is not None:
        input_["model_name"] = model_name

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