Skip to content

update_experiment async

update_experiment(
    experiment_id: ExperimentId,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    name: Optional[ExperimentName] = None,
    description: Optional[Description] = None,
    experiment_config: Optional[ExperimentConfig] = None,
    baseline_run_id: Optional[ExperimentRunIdOrEmpty] = None,
) -> UpdateExperimentOutput

Updates an experiment. Only the provided fields are changed; omitted fields are left unchanged. A request must set at least one of name, description, experimentConfig, or baselineRunId, and the target and type cannot be changed. Fails with a ConflictException if experimentConfig is changed while a run is RUNNING or STOPPING. Changes to the name, description, or baseline run are always allowed.

Parameters:

  • experiment_id (ExperimentId) –

    The ID of the experiment to update.

  • name (Optional[ExperimentName], default: None ) –

    A new name for the experiment. Omit to leave unchanged.

  • description (Optional[Description], default: None ) –

    A new description of the experiment. Omit to leave unchanged; an empty string clears it.

  • experiment_config (Optional[ExperimentConfig], default: None ) –

    A new configuration for the experiment. Omit to leave unchanged. Replaces the configuration in full, and its member must match the experiment's type: a DATASET experiment takes only experimentConfig.dataset. The configuration is validated as in CreateExperiment: a new execution role requires iam:PassRole, the role must be assumable, and the results log group must exist and use the Standard log class. Applies to runs started after the update.

  • baseline_run_id (Optional[ExperimentRunIdOrEmpty], default: None ) –

    The ID of the run to make the experiment's baseline. Omit to leave unchanged; an empty string clears it. The run must be a COMPLETED target run of this experiment. A live control's run is rejected whether or not it has ended, but a run used as another run's historical control is a target run and is accepted. Otherwise fails with a ValidationException. Deleting the baseline run clears the baseline.

Raises:

Examples:

Set an experiment's baseline run and description The following example makes a completed run the experiment's baseline and changes its description; omitted fields, including the configuration, are left unchanged. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.update_experiment(experiment_id='exp-01JC8Z5V7Q3M9K2T4R6W8Y0ABC', description='Checks booking accuracy before each release. Baseline is the November release.', baseline_run_id='ci-build-4790')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def update_experiment(
    self,
    experiment_id: "capo_cloudwatchomni.types.experiment_id.ExperimentId",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    name: Optional[
        "capo_cloudwatchomni.types.experiment_name.ExperimentName"
    ] = None,
    description: Optional[
        "capo_cloudwatchomni.types.description.Description"
    ] = None,
    experiment_config: Optional[
        "capo_cloudwatchomni.types.experiment_config.ExperimentConfig"
    ] = None,
    baseline_run_id: Optional[
        "capo_cloudwatchomni.types.experiment_run_id_or_empty.ExperimentRunIdOrEmpty"
    ] = None,
) -> "capo_cloudwatchomni.types.update_experiment_output.UpdateExperimentOutput":
    """Updates an experiment. Only the provided fields are changed; omitted fields are left unchanged. A request must set at least one of name, description, experimentConfig, or baselineRunId, and the target and type cannot be changed. Fails with a ConflictException if experimentConfig is changed while a run is RUNNING or STOPPING. Changes to the name, description, or baseline run are always allowed.

    Args:
        experiment_id: The ID of the experiment to update.
        name: A new name for the experiment. Omit to leave unchanged.
        description: A new description of the experiment. Omit to leave unchanged; an empty string clears it.
        experiment_config: A new configuration for the experiment. Omit to leave unchanged. Replaces the configuration in full, and its member must match the experiment's type: a DATASET experiment takes only experimentConfig.dataset. The configuration is validated as in CreateExperiment: a new execution role requires iam:PassRole, the role must be assumable, and the results log group must exist and use the Standard log class. Applies to runs started after the update.
        baseline_run_id: The ID of the run to make the experiment's baseline. Omit to leave unchanged; an empty string clears it. The run must be a COMPLETED target run of this experiment. A live control's run is rejected whether or not it has ended, but a run used as another run's historical control is a target run and is accepted. Otherwise fails with a ValidationException. Deleting the baseline run clears the baseline.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Set an experiment's baseline run and description
        The following example makes a completed run the experiment's baseline and changes its description; omitted fields, including the configuration, are left unchanged. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.update_experiment(experiment_id='exp-01JC8Z5V7Q3M9K2T4R6W8Y0ABC', description='Checks booking accuracy before each release. Baseline is the November release.', baseline_run_id='ci-build-4790')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.update_experiment_input.UpdateExperimentInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.update_experiment_output.UpdateExperimentOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.update_experiment

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.update_experiment.async_update_experiment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudwatchomni.types.update_experiment_input.UpdateExperimentInput",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.update_experiment_input

        return capo_cloudwatchomni.types.update_experiment_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_cloudwatchomni.types.update_experiment_output.UpdateExperimentOutput",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.update_experiment_output

        return capo_cloudwatchomni.types.update_experiment_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateExperiment",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_cloudwatchomni.types.update_experiment_input.UpdateExperimentInput = {
        "experiment_id": experiment_id
    }
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    if experiment_config is not None:
        input_["experiment_config"] = experiment_config
    if baseline_run_id is not None:
        input_["baseline_run_id"] = baseline_run_id

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