EMR / Client / list_clusters

list_clusters#

EMR.Client.list_clusters(**kwargs)#

Provides the status of all clusters visible to this Amazon Web Services account. Allows you to filter the list of clusters based on certain criteria; for example, filtering by cluster creation date and time or by status. This call returns a maximum of 50 clusters in unsorted order per call, but returns a marker to track the paging of the cluster list across multiple ListClusters calls.

See also: AWS API Documentation

Request Syntax

response = client.list_clusters(
    CreatedAfter=datetime(2015, 1, 1),
    CreatedBefore=datetime(2015, 1, 1),
    ClusterStates=[
        'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
    ],
    Marker='string'
)
Parameters:
  • CreatedAfter (datetime) – The creation date and time beginning value filter for listing clusters.

  • CreatedBefore (datetime) – The creation date and time end value filter for listing clusters.

  • ClusterStates (list) –

    The cluster state filters to apply when listing clusters. Clusters that change state while this action runs may be not be returned as expected in the list of clusters.

    • (string) –

  • Marker (string) – The pagination token that indicates the next set of results to retrieve.

Return type:

dict

Returns:

Response Syntax

{
    'Clusters': [
        {
            'Id': 'string',
            'Name': 'string',
            'Status': {
                'State': 'STARTING'|'BOOTSTRAPPING'|'RUNNING'|'WAITING'|'TERMINATING'|'TERMINATED'|'TERMINATED_WITH_ERRORS',
                'StateChangeReason': {
                    'Code': 'INTERNAL_ERROR'|'VALIDATION_ERROR'|'INSTANCE_FAILURE'|'INSTANCE_FLEET_TIMEOUT'|'BOOTSTRAP_FAILURE'|'USER_REQUEST'|'STEP_FAILURE'|'ALL_STEPS_COMPLETED',
                    'Message': 'string'
                },
                'Timeline': {
                    'CreationDateTime': datetime(2015, 1, 1),
                    'ReadyDateTime': datetime(2015, 1, 1),
                    'EndDateTime': datetime(2015, 1, 1)
                },
                'ErrorDetails': [
                    {
                        'ErrorCode': 'string',
                        'ErrorData': [
                            {
                                'string': 'string'
                            },
                        ],
                        'ErrorMessage': 'string'
                    },
                ]
            },
            'NormalizedInstanceHours': 123,
            'ClusterArn': 'string',
            'OutpostArn': 'string'
        },
    ],
    'Marker': 'string'
}

Response Structure

  • (dict) –

    This contains a ClusterSummaryList with the cluster details; for example, the cluster IDs, names, and status.

    • Clusters (list) –

      The list of clusters for the account based on the given filters.

      • (dict) –

        The summary description of the cluster.

        • Id (string) –

          The unique identifier for the cluster.

        • Name (string) –

          The name of the cluster.

        • Status (dict) –

          The details about the current status of the cluster.

          • State (string) –

            The current state of the cluster.

          • StateChangeReason (dict) –

            The reason for the cluster status change.

            • Code (string) –

              The programmatic code for the state change reason.

            • Message (string) –

              The descriptive message for the state change reason.

          • Timeline (dict) –

            A timeline that represents the status of a cluster over the lifetime of the cluster.

            • CreationDateTime (datetime) –

              The creation date and time of the cluster.

            • ReadyDateTime (datetime) –

              The date and time when the cluster was ready to run steps.

            • EndDateTime (datetime) –

              The date and time when the cluster was terminated.

          • ErrorDetails (list) –

            A list of tuples that provide information about the errors that caused a cluster termination. This structure may have up to 10 different ErrorDetail tuples.

            • (dict) –

              A tuple that provides information about an error that caused a cluster to terminate.

              • ErrorCode (string) –

                The name or code that’s associated with the error.

              • ErrorData (list) –

                A list of key value pairs that provide contextual information to explain why the error may have occured.

                • (dict) –

                  • (string) –

                    • (string) –

              • ErrorMessage (string) –

                A message describing the error that occured.

        • NormalizedInstanceHours (integer) –

          An approximation of the cost of the cluster, represented in m1.small/hours. This value is incremented one time for every hour an m1.small instance runs. Larger instances are weighted more, so an EC2 instance that is roughly four times more expensive would result in the normalized instance hours being incremented by four. This result is only an approximation and does not reflect the actual billing rate.

        • ClusterArn (string) –

          The Amazon Resource Name of the cluster.

        • OutpostArn (string) –

          The Amazon Resource Name (ARN) of the Outpost where the cluster is launched.

    • Marker (string) –

      The pagination token that indicates the next set of results to retrieve.

Exceptions

  • EMR.Client.exceptions.InternalServerException

  • EMR.Client.exceptions.InvalidRequestException