Skip to content

list_training_sessions

list_training_sessions(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    creation_time_after: Optional[Timestamp] = None,
    creation_time_before: Optional[Timestamp] = None,
    name_contains: Optional[NameContains] = None,
    status_equals: Optional[TrainingSessionStatus] = None,
) -> ListTrainingSessionsResponse

Lists training sessions in your account. You can filter results by creation time, name, and status. The operation paginates results. To retrieve additional results, use the NextToken parameter.

The following operations are related to ListTrainingSessions:

  • CreateTrainingSession

  • DescribeTrainingSession

Parameters:

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

    If the response was truncated, use the token returned in the previous response to retrieve the next page of results.

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

    The maximum number of training sessions to return in the response.

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

    A filter that returns only training sessions created after the specified time.

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

    A filter that returns only training sessions created before the specified time.

  • name_contains (Optional[NameContains], default: None ) –

    A string in the training session name to filter results. Only sessions whose name contains the specified string are returned.

  • status_equals (Optional[TrainingSessionStatus], default: None ) –

    A filter that returns only training sessions with the specified status.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def list_training_sessions(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
    creation_time_after: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    creation_time_before: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    name_contains: Optional[
        "capo_sagemaker.types.name_contains.NameContains"
    ] = None,
    status_equals: Optional[
        "capo_sagemaker.types.training_session_status.TrainingSessionStatus"
    ] = None,
) -> "capo_sagemaker.types.list_training_sessions_response.ListTrainingSessionsResponse":
    """<p>Lists training sessions in your account. You can filter results by creation time, name, and status. The operation paginates results. To retrieve additional results, use the <code>NextToken</code> parameter.</p> <p>The following operations are related to <code>ListTrainingSessions</code>:</p> <ul> <li> <p> <code>CreateTrainingSession</code> </p> </li> <li> <p> <code>DescribeTrainingSession</code> </p> </li> </ul>

    Args:
        next_token: <p>If the response was truncated, use the token returned in the previous response to retrieve the next page of results.</p>
        max_results: <p>The maximum number of training sessions to return in the response.</p>
        creation_time_after: <p>A filter that returns only training sessions created after the specified time.</p>
        creation_time_before: <p>A filter that returns only training sessions created before the specified time.</p>
        name_contains: <p>A string in the training session name to filter results. Only sessions whose name contains the specified string are returned.</p>
        status_equals: <p>A filter that returns only training sessions with the specified status.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.list_training_sessions_request.ListTrainingSessionsRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.list_training_sessions_response.ListTrainingSessionsResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.list_training_sessions

        output, http_response = (
            capo_sagemaker._operations.sage_maker.list_training_sessions.list_training_sessions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListTrainingSessions")
    )
    input_: capo_sagemaker.types.list_training_sessions_request.ListTrainingSessionsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if creation_time_after is not None:
        input_["creation_time_after"] = creation_time_after
    if creation_time_before is not None:
        input_["creation_time_before"] = creation_time_before
    if name_contains is not None:
        input_["name_contains"] = name_contains
    if status_equals is not None:
        input_["status_equals"] = status_equals

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