Skip to content

associate_trial_component async

associate_trial_component(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    trial_component_name: Optional[ExperimentEntityName] = None,
    trial_name: Optional[ExperimentEntityName] = None,
) -> AssociateTrialComponentResponse

Associates a trial component with a trial. A trial component can be associated with multiple trials. To disassociate a trial component from a trial, call the DisassociateTrialComponent API.

Parameters:

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def associate_trial_component(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    trial_component_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    trial_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
) -> "capo_sagemaker.types.associate_trial_component_response.AssociateTrialComponentResponse":
    """<p>Associates a trial component with a trial. A trial component can be associated with multiple trials. To disassociate a trial component from a trial, call the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DisassociateTrialComponent.html">DisassociateTrialComponent</a> API.</p>

    Args:
        trial_component_name: <p>The name of the component to associated with the trial.</p>
        trial_name: <p>The name of the trial to associate with.</p>

    Raises:
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.associate_trial_component_request.AssociateTrialComponentRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.associate_trial_component_response.AssociateTrialComponentResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.associate_trial_component

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.associate_trial_component.async_associate_trial_component(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateTrialComponent")
    )
    input_: capo_sagemaker.types.associate_trial_component_request.AssociateTrialComponentRequest = {}
    if trial_component_name is not None:
        input_["trial_component_name"] = trial_component_name
    if trial_name is not None:
        input_["trial_name"] = trial_name

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