Skip to content

delete_experiment

delete_experiment(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    experiment_name: Optional[ExperimentEntityName] = None,
) -> DeleteExperimentResponse

Deletes an SageMaker experiment. All trials associated with the experiment must be deleted first. Use the ListTrials API to get a list of the trials associated with the experiment.

Parameters:

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def delete_experiment(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    experiment_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
) -> "capo_sagemaker.types.delete_experiment_response.DeleteExperimentResponse":
    """<p>Deletes an SageMaker experiment. All trials associated with the experiment must be deleted first. Use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListTrials.html">ListTrials</a> API to get a list of the trials associated with the experiment.</p>

    Args:
        experiment_name: <p>The name of the experiment to delete.</p>

    Raises:
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.delete_experiment_request.DeleteExperimentRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.delete_experiment_response.DeleteExperimentResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.delete_experiment

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteExperiment")
    )
    input_: capo_sagemaker.types.delete_experiment_request.DeleteExperimentRequest = {}
    if experiment_name is not None:
        input_["experiment_name"] = experiment_name

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