Skip to content

update_experiment_definition

update_experiment_definition(
    application_identifier: Identifier,
    experiment_definition_identifier: Identifier,
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    treatments: Optional[TreatmentInputList] = None,
    control: Optional[TreatmentInput] = None,
    hypothesis: Optional[Description] = None,
    audience_rule: Optional[Rule] = None,
    audience_description: Optional[Description] = None,
    launch_criteria: Optional[Description] = None,
) -> ExperimentDefinition

Updates an experiment definition. You can update treatments, the control, audience rules, and other properties. You cannot update an experiment definition while an experiment run is active.

Parameters:

  • application_identifier (Identifier) –

    The application ID or name.

  • experiment_definition_identifier (Identifier) –

    The experiment definition ID or name.

  • treatments (Optional[TreatmentInputList], default: None ) –

    The updated list of treatments to evaluate during the experiment. Each treatment defines a distinct variation compared to the control.

  • control (Optional[TreatmentInput], default: None ) –

    An updated control treatment.

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

    An updated hypothesis.

  • audience_rule (Optional[Rule], default: None ) –

    An updated audience rule.

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

    An updated audience description.

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

    Updated launch criteria.

Raises:

Examples:

To update an experiment definition The following UpdateExperimentDefinition example updates the hypothesis and audience rule of an experiment definition.

>>> client.update_experiment_definition(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', hypothesis='Enabling the feature will increase conversion by 10%', audience_rule='(eq $country "US")')
Source code in docs_src/capo_appconfig/_services/app_config.py
def update_experiment_definition(
    self,
    application_identifier: "capo_appconfig.types.identifier.Identifier",
    experiment_definition_identifier: "capo_appconfig.types.identifier.Identifier",
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    treatments: Optional[
        "capo_appconfig.types.treatment_input_list.TreatmentInputList"
    ] = None,
    control: Optional["capo_appconfig.types.treatment_input.TreatmentInput"] = None,
    hypothesis: Optional["capo_appconfig.types.description.Description"] = None,
    audience_rule: Optional["capo_appconfig.types.rule.Rule"] = None,
    audience_description: Optional[
        "capo_appconfig.types.description.Description"
    ] = None,
    launch_criteria: Optional[
        "capo_appconfig.types.description.Description"
    ] = None,
) -> "capo_appconfig.types.experiment_definition.ExperimentDefinition":
    """<p>Updates an experiment definition. You can update treatments, the control, audience rules, and other properties. You cannot update an experiment definition while an experiment run is active.</p>

    Args:
        application_identifier: <p>The application ID or name.</p>
        experiment_definition_identifier: <p>The experiment definition ID or name.</p>
        treatments: <p>The updated list of treatments to evaluate during the experiment. Each treatment defines a distinct variation compared to the control.</p>
        control: <p>An updated control treatment.</p>
        hypothesis: <p>An updated hypothesis.</p>
        audience_rule: <p>An updated audience rule.</p>
        audience_description: <p>An updated audience description.</p>
        launch_criteria: <p>Updated launch criteria.</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 definition
        The following UpdateExperimentDefinition example updates the hypothesis and audience rule of an experiment definition.

        >>> client.update_experiment_definition(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', hypothesis='Enabling the feature will increase conversion by 10%', audience_rule='(eq $country "US")')
    """

    def _handler(
        req: "OperationRequest[capo_appconfig.types.update_experiment_definition_request.UpdateExperimentDefinitionRequest]",
    ) -> OperationResponse[
        "capo_appconfig.types.experiment_definition.ExperimentDefinition"
    ]:
        import capo_appconfig._operations.amazon_app_config.update_experiment_definition

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateExperimentDefinition")
    )
    input_: capo_appconfig.types.update_experiment_definition_request.UpdateExperimentDefinitionRequest = {
        "application_identifier": application_identifier,
        "experiment_definition_identifier": experiment_definition_identifier,
    }
    if treatments is not None:
        input_["treatments"] = treatments
    if control is not None:
        input_["control"] = control
    if hypothesis is not None:
        input_["hypothesis"] = hypothesis
    if audience_rule is not None:
        input_["audience_rule"] = audience_rule
    if audience_description is not None:
        input_["audience_description"] = audience_description
    if launch_criteria is not None:
        input_["launch_criteria"] = launch_criteria

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