list_sessions

list_sessions(**kwargs)

Lists the sessions in a workgroup that are in an active state like CREATING , CREATED , IDLE , or BUSY . Newer sessions are listed first; older sessions are listed later.

See also: AWS API Documentation

Request Syntax

response = client.list_sessions(
    WorkGroup='string',
    StateFilter='CREATING'|'CREATED'|'IDLE'|'BUSY'|'TERMINATING'|'TERMINATED'|'DEGRADED'|'FAILED',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • WorkGroup (string) --

    [REQUIRED]

    The workgroup to which the session belongs.

  • StateFilter (string) --

    A filter for a specific session state. A description of each state follows.

    CREATING - The session is being started, including acquiring resources.

    CREATED - The session has been started.

    IDLE - The session is able to accept a calculation.

    BUSY - The session is processing another task and is unable to accept a calculation.

    TERMINATING - The session is in the process of shutting down.

    TERMINATED - The session and its resources are no longer running.

    DEGRADED - The session has no healthy coordinators.

    FAILED - Due to a failure, the session and its resources are no longer running.

  • MaxResults (integer) -- The maximum number of sessions to return.
  • NextToken (string) -- A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Return type

dict

Returns

Response Syntax

{
    'NextToken': 'string',
    'Sessions': [
        {
            'SessionId': 'string',
            'Description': 'string',
            'EngineVersion': {
                'SelectedEngineVersion': 'string',
                'EffectiveEngineVersion': 'string'
            },
            'NotebookVersion': 'string',
            'Status': {
                'StartDateTime': datetime(2015, 1, 1),
                'LastModifiedDateTime': datetime(2015, 1, 1),
                'EndDateTime': datetime(2015, 1, 1),
                'IdleSinceDateTime': datetime(2015, 1, 1),
                'State': 'CREATING'|'CREATED'|'IDLE'|'BUSY'|'TERMINATING'|'TERMINATED'|'DEGRADED'|'FAILED',
                'StateChangeReason': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.

    • Sessions (list) --

      A list of sessions.

      • (dict) --

        Contains summary information about a notebook session.

        • SessionId (string) --

          The session ID.

        • Description (string) --

          The session description.

        • EngineVersion (dict) --

          The engine version used by the session (for example, PySpark engine version 3 ).

          • SelectedEngineVersion (string) --

            The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.

          • EffectiveEngineVersion (string) --

            Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.

        • NotebookVersion (string) --

          The notebook version.

        • Status (dict) --

          Contains information about the session status.

          • StartDateTime (datetime) --

            The date and time that the session started.

          • LastModifiedDateTime (datetime) --

            The most recent date and time that the session was modified.

          • EndDateTime (datetime) --

            The date and time that the session ended.

          • IdleSinceDateTime (datetime) --

            The date and time starting at which the session became idle. Can be empty if the session is not currently idle.

          • State (string) --

            The state of the session. A description of each state follows.

            CREATING - The session is being started, including acquiring resources.

            CREATED - The session has been started.

            IDLE - The session is able to accept a calculation.

            BUSY - The session is processing another task and is unable to accept a calculation.

            TERMINATING - The session is in the process of shutting down.

            TERMINATED - The session and its resources are no longer running.

            DEGRADED - The session has no healthy coordinators.

            FAILED - Due to a failure, the session and its resources are no longer running.

          • StateChangeReason (string) --

            The reason for the session state change (for example, canceled because the session was terminated).

Exceptions

  • Athena.Client.exceptions.InternalServerException
  • Athena.Client.exceptions.InvalidRequestException
  • Athena.Client.exceptions.ResourceNotFoundException