Skip to content

list_trials async

list_trials(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    experiment_name: Optional[ExperimentEntityName] = None,
    trial_component_name: Optional[ExperimentEntityName] = None,
    created_after: Optional[Timestamp] = None,
    created_before: Optional[Timestamp] = None,
    sort_by: Optional[SortTrialsBy] = None,
    sort_order: Optional[SortOrder] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListTrialsResponse

Lists the trials in your account. Specify an experiment name to limit the list to the trials that are part of that experiment. Specify a trial component name to limit the list to the trials that associated with that trial component. The list can be filtered to show only trials that were created in a specific time range. The list can be sorted by trial name or creation time.

Parameters:

  • experiment_name (Optional[ExperimentEntityName], default: None ) –

    A filter that returns only trials that are part of the specified experiment.

  • trial_component_name (Optional[ExperimentEntityName], default: None ) –

    A filter that returns only trials that are associated with the specified trial component.

  • created_after (Optional[Timestamp], default: None ) –

    A filter that returns only trials created after the specified time.

  • created_before (Optional[Timestamp], default: None ) –

    A filter that returns only trials created before the specified time.

  • sort_by (Optional[SortTrialsBy], default: None ) –

    The property used to sort results. The default value is CreationTime.

  • sort_order (Optional[SortOrder], default: None ) –

    The sort order. The default value is Descending.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of trials to return in the response. The default value is 10.

  • next_token (Optional[NextToken], default: None ) –

    If the previous call to ListTrials didn't return the full set of trials, the call returns a token for getting the next set of trials.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def list_trials(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    experiment_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    trial_component_name: Optional[
        "capo_sagemaker.types.experiment_entity_name.ExperimentEntityName"
    ] = None,
    created_after: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    created_before: Optional["capo_sagemaker.types.timestamp.Timestamp"] = None,
    sort_by: Optional["capo_sagemaker.types.sort_trials_by.SortTrialsBy"] = None,
    sort_order: Optional["capo_sagemaker.types.sort_order.SortOrder"] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
) -> "capo_sagemaker.types.list_trials_response.ListTrialsResponse":
    """<p>Lists the trials in your account. Specify an experiment name to limit the list to the trials that are part of that experiment. Specify a trial component name to limit the list to the trials that associated with that trial component. The list can be filtered to show only trials that were created in a specific time range. The list can be sorted by trial name or creation time.</p>

    Args:
        experiment_name: <p>A filter that returns only trials that are part of the specified experiment.</p>
        trial_component_name: <p>A filter that returns only trials that are associated with the specified trial component.</p>
        created_after: <p>A filter that returns only trials created after the specified time.</p>
        created_before: <p>A filter that returns only trials created before the specified time.</p>
        sort_by: <p>The property used to sort results. The default value is <code>CreationTime</code>.</p>
        sort_order: <p>The sort order. The default value is <code>Descending</code>.</p>
        max_results: <p>The maximum number of trials to return in the response. The default value is 10.</p>
        next_token: <p>If the previous call to <code>ListTrials</code> didn't return the full set of trials, the call returns a token for getting the next set of trials.</p>

    Raises:
        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.list_trials_request.ListTrialsRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.list_trials_response.ListTrialsResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.list_trials

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListTrials")
    )
    input_: capo_sagemaker.types.list_trials_request.ListTrialsRequest = {}
    if experiment_name is not None:
        input_["experiment_name"] = experiment_name
    if trial_component_name is not None:
        input_["trial_component_name"] = trial_component_name
    if created_after is not None:
        input_["created_after"] = created_after
    if created_before is not None:
        input_["created_before"] = created_before
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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