Skip to content

get_experiment async

get_experiment(
    experiment_id: ExperimentId,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
) -> GetExperimentOutput

Retrieves the details of an experiment by ID. The response includes the experiment's target, type, configuration, run count, latest run, and baseline run. To read the experiment's tags, call ListTagsForResource with its ARN. Use ListExperiments to enumerate experiments.

Parameters:

  • experiment_id (ExperimentId) –

    The ID of the experiment.

Raises:

Examples:

Get an experiment The following example retrieves an experiment that has three runs. The latest run was reported from a CI build and passed its rule. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.get_experiment(experiment_id='exp-01JC8Z5V7Q3M9K2T4R6W8Y0ABC')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def get_experiment(
    self,
    experiment_id: "capo_cloudwatchomni.types.experiment_id.ExperimentId",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
) -> "capo_cloudwatchomni.types.get_experiment_output.GetExperimentOutput":
    """Retrieves the details of an experiment by ID. The response includes the experiment's target, type, configuration, run count, latest run, and baseline run. To read the experiment's tags, call ListTagsForResource with its ARN. Use ListExperiments to enumerate experiments.

    Args:
        experiment_id: The ID of the experiment.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        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:
        Get an experiment
        The following example retrieves an experiment that has three runs. The latest run was reported from a CI build and passed its rule. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.get_experiment(experiment_id='exp-01JC8Z5V7Q3M9K2T4R6W8Y0ABC')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.get_experiment_input.GetExperimentInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.get_experiment_output.GetExperimentOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.get_experiment

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

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

        return capo_cloudwatchomni.types.get_experiment_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetExperiment", redact_output=_redact_output),
    )
    input_: capo_cloudwatchomni.types.get_experiment_input.GetExperimentInput = {
        "experiment_id": experiment_id
    }

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