Skip to content

start_experiment_run async

start_experiment_run(
    application_identifier: Identifier,
    experiment_definition_identifier: Identifier,
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = None,
    description: Optional[Description] = None,
    exposure_percentage: Optional[NullablePercentage] = None,
    treatment_overrides: Optional[TreatmentOverrides] = None,
    tags: Optional[TagMap] = None,
    deployment_parameters: Optional[DeploymentParameters] = None,
) -> ExperimentRun

Starts an experiment run for the specified experiment definition. An experiment run delivers treatments to the target audience and collects metrics. You can start multiple experiment runs from the same experiment definition.

Billing for this experiment begins when you call this operation and continues until the experiment is stopped. For pricing details, see AppConfig pricing.

Parameters:

  • application_identifier (Identifier) –

    The application ID or name.

  • experiment_definition_identifier (Identifier) –

    The experiment definition ID or name.

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

    A description of this experiment run.

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

    The percentage of the target audience to expose to treatments. Set to 0 to validate the experiment before exposing production users.

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

    Treatment assignment overrides that assign specific entity IDs to treatments directly, bypassing random assignment.

  • tags (Optional[TagMap], default: None ) –

    The tags to assign to the experiment run.

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

    The deployment parameters for the experiment run, including a KMS key identifier for encryption.

Raises:

Examples:

To start an experiment run The following StartExperimentRun example starts an experiment run with 50% audience exposure.

>>> await client.start_experiment_run(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', exposure_percentage=50.0)
Source code in docs_src/capo_appconfig/_services/async_app_config.py
async def start_experiment_run(
    self,
    application_identifier: "capo_appconfig.types.identifier.Identifier",
    experiment_definition_identifier: "capo_appconfig.types.identifier.Identifier",
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = 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,
    tags: Optional["capo_appconfig.types.tag_map.TagMap"] = None,
    deployment_parameters: Optional[
        "capo_appconfig.types.deployment_parameters.DeploymentParameters"
    ] = None,
) -> "capo_appconfig.types.experiment_run.ExperimentRun":
    """<p>Starts an experiment run for the specified experiment definition. An experiment run delivers treatments to the target audience and collects metrics. You can start multiple experiment runs from the same experiment definition.</p> <note> <p>Billing for this experiment begins when you call this operation and continues until the experiment is stopped. For pricing details, see <a href="https://aws.amazon.com/systems-manager/pricing/">AppConfig pricing</a>.</p> </note>

    Args:
        application_identifier: <p>The application ID or name.</p>
        experiment_definition_identifier: <p>The experiment definition ID or name.</p>
        description: <p>A description of this experiment run.</p>
        exposure_percentage: <p>The percentage of the target audience to expose to treatments. Set to 0 to validate the experiment before exposing production users.</p>
        treatment_overrides: <p>Treatment assignment overrides that assign specific entity IDs to treatments directly, bypassing random assignment.</p>
        tags: <p>The tags to assign to the experiment run.</p>
        deployment_parameters: <p>The deployment parameters for the experiment run, including a KMS key identifier for encryption.</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 start an experiment run
        The following StartExperimentRun example starts an experiment run with 50% audience exposure.

        >>> await client.start_experiment_run(application_identifier='339ohji', experiment_definition_identifier='bsxyd7k', exposure_percentage=50.0)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appconfig.types.start_experiment_run_request.StartExperimentRunRequest]",
    ) -> AsyncOperationResponse[
        "capo_appconfig.types.experiment_run.ExperimentRun"
    ]:
        import capo_appconfig._operations.amazon_app_config.start_experiment_run

        (
            output,
            http_response,
        ) = await capo_appconfig._operations.amazon_app_config.start_experiment_run.async_start_experiment_run(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return capo_appconfig.types.start_experiment_run_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartExperimentRun", redact_input=_redact_input),
    )
    input_: capo_appconfig.types.start_experiment_run_request.StartExperimentRunRequest = {
        "application_identifier": application_identifier,
        "experiment_definition_identifier": experiment_definition_identifier,
    }
    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 tags is not None:
        input_["tags"] = tags
    if deployment_parameters is not None:
        input_["deployment_parameters"] = deployment_parameters

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