Skip to content

update_experiment_run

update_experiment_run(
    application_identifier: Identifier,
    experiment_definition_identifier: Identifier,
    run: PositiveInteger,
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    description: Optional[Description] = None,
    exposure_percentage: Optional[NullablePercentage] = None,
    treatment_overrides: Optional[TreatmentOverrides] = None,
    deployment_parameters: Optional[DeploymentParameters] = None,
) -> ExperimentRun

Updates a running experiment. Use this operation to increase audience exposure, modify treatment assignment overrides, or update the description of an active experiment run. Audience exposure can only be increased, not decreased.

Parameters:

  • application_identifier (Identifier) –

    The application ID or name.

  • experiment_definition_identifier (Identifier) –

    The experiment definition ID or name.

  • run (PositiveInteger) –

    The run number to update.

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

    An updated description for the experiment run.

  • exposure_percentage (Optional[NullablePercentage], default: None ) –

    The new exposure percentage. This value can only be increased from the current setting.

  • treatment_overrides (Optional[TreatmentOverrides], default: None ) –

    The updated treatment assignment overrides that assign specific entity IDs to treatments, bypassing random assignment.

  • deployment_parameters (Optional[DeploymentParameters], default: None ) –

    The updated deployment parameters for the experiment run.

Raises:

Examples:

To update an experiment run The following UpdateExperimentRun example increases the exposure percentage of a running experiment.

>>> client.update_experiment_run(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', run=1, exposure_percentage=75.0)
Source code in docs_src/capo_appconfig/_services/app_config.py
def update_experiment_run(
    self,
    application_identifier: "capo_appconfig.types.identifier.Identifier",
    experiment_definition_identifier: "capo_appconfig.types.identifier.Identifier",
    run: "capo_appconfig.types.positive_integer.PositiveInteger",
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    description: Optional["capo_appconfig.types.description.Description"] = None,
    exposure_percentage: Optional[
        "capo_appconfig.types.nullable_percentage.NullablePercentage"
    ] = None,
    treatment_overrides: Optional[
        "capo_appconfig.types.treatment_overrides.TreatmentOverrides"
    ] = None,
    deployment_parameters: Optional[
        "capo_appconfig.types.deployment_parameters.DeploymentParameters"
    ] = None,
) -> "capo_appconfig.types.experiment_run.ExperimentRun":
    """<p>Updates a running experiment. Use this operation to increase audience exposure, modify treatment assignment overrides, or update the description of an active experiment run. Audience exposure can only be increased, not decreased.</p>

    Args:
        application_identifier: <p>The application ID or name.</p>
        experiment_definition_identifier: <p>The experiment definition ID or name.</p>
        run: <p>The run number to update.</p>
        description: <p>An updated description for the experiment run.</p>
        exposure_percentage: <p>The new exposure percentage. This value can only be increased from the current setting.</p>
        treatment_overrides: <p>The updated treatment assignment overrides that assign specific entity IDs to treatments, bypassing random assignment.</p>
        deployment_parameters: <p>The updated deployment parameters for the experiment run.</p>

    Raises:
        capo_appconfig.errors.bad_request_exception.BadRequestException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_appconfig.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_appconfig.errors.internal_server_exception.InternalServerException: <p>There was an internal failure in the AppConfig service.</p>
        capo_appconfig.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_appconfig.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To update an experiment run
        The following UpdateExperimentRun example increases the exposure percentage of a running experiment.

        >>> client.update_experiment_run(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', run=1, exposure_percentage=75.0)
    """

    def _handler(
        req: "OperationRequest[capo_appconfig.types.update_experiment_run_request.UpdateExperimentRunRequest]",
    ) -> OperationResponse["capo_appconfig.types.experiment_run.ExperimentRun"]:
        import capo_appconfig._operations.amazon_app_config.update_experiment_run

        output, http_response = (
            capo_appconfig._operations.amazon_app_config.update_experiment_run.update_experiment_run(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_appconfig.types.update_experiment_run_request.UpdateExperimentRunRequest",
    ) -> dict[str, Any]:
        import capo_appconfig.types.update_experiment_run_request

        return capo_appconfig.types.update_experiment_run_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateExperimentRun", redact_input=_redact_input),
    )
    input_: capo_appconfig.types.update_experiment_run_request.UpdateExperimentRunRequest = {
        "application_identifier": application_identifier,
        "experiment_definition_identifier": experiment_definition_identifier,
        "run": run,
    }
    if description is not None:
        input_["description"] = description
    if exposure_percentage is not None:
        input_["exposure_percentage"] = exposure_percentage
    if treatment_overrides is not None:
        input_["treatment_overrides"] = treatment_overrides
    if deployment_parameters is not None:
        input_["deployment_parameters"] = deployment_parameters

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