Skip to content

list_cluster_operations

list_cluster_operations(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    cluster_name: Optional[ClusterNameOrArn] = None,
    status: Optional[ClusterOperationStatus] = None,
    type: Optional[ClusterOperationType] = None,
    creation_time_after: Optional[Timestamp] = None,
    creation_time_before: Optional[Timestamp] = None,
    sort_by: Optional[ClusterOperationSortBy] = None,
    sort_order: Optional[SortOrder] = None,
    max_results: Optional[ClusterOperationMaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListClusterOperationsResponse

Retrieves a list of operation summaries for a specified HyperPod cluster, such as scaling operations and deep health checks. The operation supports filtering, sorting, and pagination of results.

Parameters:

  • cluster_name (Optional[ClusterNameOrArn], default: None ) –

    The name or Amazon Resource Name (ARN) of the HyperPod cluster for which to list operations.

  • status (Optional[ClusterOperationStatus], default: None ) –

    The operation status to filter by. If specified, only operations with this status are returned. Valid values are InProgress, Superseded, or Done.

  • type (Optional[ClusterOperationType], default: None ) –

    The operation type to filter by. If specified, only operations of this type are returned. Valid values are Scaling or DeepHealthCheck.

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

    The start of the time range for filtering operations. Only operations created after this time are included in the results.

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

    The end of the time range for filtering operations. Only operations created before this time are included in the results.

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

    The field to use for sorting the operation list. Currently, the only supported value is CreationTime.

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

    The order in which to sort the results. Valid values are Ascending or Descending (the default is Descending).

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

    The maximum number of operations to return in the response. Valid range is 1 to 100.

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

    A token to retrieve the next set of results. This token is obtained from the output of a previous ListClusterOperations call.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def list_cluster_operations(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    cluster_name: Optional[
        "capo_sagemaker.types.cluster_name_or_arn.ClusterNameOrArn"
    ] = None,
    status: Optional[
        "capo_sagemaker.types.cluster_operation_status.ClusterOperationStatus"
    ] = None,
    type: Optional[
        "capo_sagemaker.types.cluster_operation_type.ClusterOperationType"
    ] = None,
    creation_time_after: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    creation_time_before: Optional[
        "capo_sagemaker.types.timestamp.Timestamp"
    ] = None,
    sort_by: Optional[
        "capo_sagemaker.types.cluster_operation_sort_by.ClusterOperationSortBy"
    ] = None,
    sort_order: Optional["capo_sagemaker.types.sort_order.SortOrder"] = None,
    max_results: Optional[
        "capo_sagemaker.types.cluster_operation_max_results.ClusterOperationMaxResults"
    ] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
) -> "capo_sagemaker.types.list_cluster_operations_response.ListClusterOperationsResponse":
    """<p>Retrieves a list of operation summaries for a specified HyperPod cluster, such as scaling operations and deep health checks. The operation supports filtering, sorting, and pagination of results.</p>

    Args:
        cluster_name: <p>The name or Amazon Resource Name (ARN) of the HyperPod cluster for which to list operations.</p>
        status: <p>The operation status to filter by. If specified, only operations with this status are returned. Valid values are <code>InProgress</code>, <code>Superseded</code>, or <code>Done</code>.</p>
        type: <p>The operation type to filter by. If specified, only operations of this type are returned. Valid values are <code>Scaling</code> or <code>DeepHealthCheck</code>.</p>
        creation_time_after: <p>The start of the time range for filtering operations. Only operations created after this time are included in the results.</p>
        creation_time_before: <p>The end of the time range for filtering operations. Only operations created before this time are included in the results.</p>
        sort_by: <p>The field to use for sorting the operation list. Currently, the only supported value is <code>CreationTime</code>.</p>
        sort_order: <p>The order in which to sort the results. Valid values are <code>Ascending</code> or <code>Descending</code> (the default is <code>Descending</code>).</p>
        max_results: <p>The maximum number of operations to return in the response. Valid range is 1 to 100.</p>
        next_token: <p>A token to retrieve the next set of results. This token is obtained from the output of a previous <code>ListClusterOperations</code> call.</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.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.list_cluster_operations_request.ListClusterOperationsRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.list_cluster_operations_response.ListClusterOperationsResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.list_cluster_operations

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListClusterOperations")
    )
    input_: capo_sagemaker.types.list_cluster_operations_request.ListClusterOperationsRequest = {}
    if cluster_name is not None:
        input_["cluster_name"] = cluster_name
    if status is not None:
        input_["status"] = status
    if type is not None:
        input_["type"] = type
    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 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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output