Skip to content

list_clusters

list_clusters(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    creation_time_after: Optional[Timestamp] = None,
    creation_time_before: Optional[Timestamp] = None,
    max_results: Optional[MaxResults] = None,
    name_contains: Optional[NameContains] = None,
    next_token: Optional[NextToken] = None,
    sort_by: Optional[ClusterSortBy] = None,
    sort_order: Optional[SortOrder] = None,
    training_plan_arn: Optional[TrainingPlanArn] = None,
) -> ListClustersResponse

Retrieves the list of SageMaker HyperPod clusters.

Parameters:

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

    Set a start time for the time range during which you want to list SageMaker HyperPod clusters. Timestamps are formatted according to the ISO 8601 standard.

    Acceptable formats include:

    • YYYY-MM-DDThh:mm:ss.sssTZD (UTC), for example, 2014-10-01T20:30:00.000Z

    • YYYY-MM-DDThh:mm:ss.sssTZD (with offset), for example, 2014-10-01T12:30:00.000-08:00

    • YYYY-MM-DD, for example, 2014-10-01

    • Unix time in seconds, for example, 1412195400. This is also referred to as Unix Epoch time and represents the number of seconds since midnight, January 1, 1970 UTC.

    For more information about the timestamp format, see Timestamp in the Amazon Web Services Command Line Interface User Guide.

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

    Set an end time for the time range during which you want to list SageMaker HyperPod clusters. A filter that returns nodes in a SageMaker HyperPod cluster created before the specified time. The acceptable formats are the same as the timestamp formats for CreationTimeAfter. For more information about the timestamp format, see Timestamp in the Amazon Web Services Command Line Interface User Guide.

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

    Specifies the maximum number of clusters to evaluate for the operation (not necessarily the number of matching items). After SageMaker processes the number of clusters up to MaxResults, it stops the operation and returns the matching clusters up to that point. If all the matching clusters are desired, SageMaker will go through all the clusters until NextToken is empty.

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

    Set the maximum number of instances to print in the list.

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

    Set the next token to retrieve the list of SageMaker HyperPod clusters.

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

    The field by which to sort results. The default value is CREATION_TIME.

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

    The sort order for results. The default value is Ascending.

  • training_plan_arn (Optional[TrainingPlanArn], default: None ) –

    The Amazon Resource Name (ARN); of the training plan to filter clusters by. For more information about reserving GPU capacity for your SageMaker HyperPod clusters using Amazon SageMaker Training Plan, see CreateTrainingPlan .

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def list_clusters(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    creation_time_after: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    creation_time_before: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
    name_contains: Optional[
        "capo_sagemaker.types.name_contains.NameContains"
    ] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
    sort_by: Optional["capo_sagemaker.types.cluster_sort_by.ClusterSortBy"] = None,
    sort_order: Optional["capo_sagemaker.types.sort_order.SortOrder"] = None,
    training_plan_arn: Optional[
        "capo_sagemaker.types.training_plan_arn.TrainingPlanArn"
    ] = None,
) -> "capo_sagemaker.types.list_clusters_response.ListClustersResponse":
    """<p>Retrieves the list of SageMaker HyperPod clusters.</p>

    Args:
        creation_time_after: <p>Set a start time for the time range during which you want to list SageMaker HyperPod clusters. Timestamps are formatted according to the ISO 8601 standard. </p> <p>Acceptable formats include:</p> <ul> <li> <p> <code>YYYY-MM-DDThh:mm:ss.sssTZD</code> (UTC), for example, <code>2014-10-01T20:30:00.000Z</code> </p> </li> <li> <p> <code>YYYY-MM-DDThh:mm:ss.sssTZD</code> (with offset), for example, <code>2014-10-01T12:30:00.000-08:00</code> </p> </li> <li> <p> <code>YYYY-MM-DD</code>, for example, <code>2014-10-01</code> </p> </li> <li> <p>Unix time in seconds, for example, <code>1412195400</code>. This is also referred to as Unix Epoch time and represents the number of seconds since midnight, January 1, 1970 UTC.</p> </li> </ul> <p>For more information about the timestamp format, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp">Timestamp</a> in the <i>Amazon Web Services Command Line Interface User Guide</i>.</p>
        creation_time_before: <p>Set an end time for the time range during which you want to list SageMaker HyperPod clusters. A filter that returns nodes in a SageMaker HyperPod cluster created before the specified time. The acceptable formats are the same as the timestamp formats for <code>CreationTimeAfter</code>. For more information about the timestamp format, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp">Timestamp</a> in the <i>Amazon Web Services Command Line Interface User Guide</i>.</p>
        max_results: <p>Specifies the maximum number of clusters to evaluate for the operation (not necessarily the number of matching items). After SageMaker processes the number of clusters up to <code>MaxResults</code>, it stops the operation and returns the matching clusters up to that point. If all the matching clusters are desired, SageMaker will go through all the clusters until <code>NextToken</code> is empty.</p>
        name_contains: <p>Set the maximum number of instances to print in the list.</p>
        next_token: <p>Set the next token to retrieve the list of SageMaker HyperPod clusters.</p>
        sort_by: <p>The field by which to sort results. The default value is <code>CREATION_TIME</code>.</p>
        sort_order: <p>The sort order for results. The default value is <code>Ascending</code>.</p>
        training_plan_arn: <p>The Amazon Resource Name (ARN); of the training plan to filter clusters by. For more information about reserving GPU capacity for your SageMaker HyperPod clusters using Amazon SageMaker Training Plan, see <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingPlan.html">CreateTrainingPlan</a> </code>.</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_clusters_request.ListClustersRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.list_clusters_response.ListClustersResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.list_clusters

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListClusters")
    )
    input_: capo_sagemaker.types.list_clusters_request.ListClustersRequest = {}
    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 max_results is not None:
        input_["max_results"] = max_results
    if name_contains is not None:
        input_["name_contains"] = name_contains
    if next_token is not None:
        input_["next_token"] = next_token
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if training_plan_arn is not None:
        input_["training_plan_arn"] = training_plan_arn

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