Skip to content

list_sessions

list_sessions(
    work_group: WorkGroupName,
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    state_filter: Optional[SessionState] = None,
    max_results: Optional[MaxSessionsCount] = None,
    next_token: Optional[SessionManagerToken] = None,
) -> ListSessionsResponse

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.

Parameters:

  • work_group (WorkGroupName) –

    The workgroup to which the session belongs.

  • state_filter (Optional[SessionState], default: None ) –

    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.

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

    The maximum number of sessions to return.

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

    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.

Raises:

Source code in docs_src/capo_athena/_services/athena.py
def list_sessions(
    self,
    work_group: "capo_athena.types.work_group_name.WorkGroupName",
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    state_filter: Optional["capo_athena.types.session_state.SessionState"] = None,
    max_results: Optional[
        "capo_athena.types.max_sessions_count.MaxSessionsCount"
    ] = None,
    next_token: Optional[
        "capo_athena.types.session_manager_token.SessionManagerToken"
    ] = None,
) -> "capo_athena.types.list_sessions_response.ListSessionsResponse":
    """<p>Lists the sessions in a workgroup that are in an active state like <code>CREATING</code>, <code>CREATED</code>, <code>IDLE</code>, or <code>BUSY</code>. Newer sessions are listed first; older sessions are listed later.</p>

    Args:
        work_group: <p>The workgroup to which the session belongs.</p>
        state_filter: <p>A filter for a specific session state. A description of each state follows.</p> <p> <code>CREATING</code> - The session is being started, including acquiring resources.</p> <p> <code>CREATED</code> - The session has been started.</p> <p> <code>IDLE</code> - The session is able to accept a calculation.</p> <p> <code>BUSY</code> - The session is processing another task and is unable to accept a calculation.</p> <p> <code>TERMINATING</code> - The session is in the process of shutting down.</p> <p> <code>TERMINATED</code> - The session and its resources are no longer running.</p> <p> <code>DEGRADED</code> - The session has no healthy coordinators.</p> <p> <code>FAILED</code> - Due to a failure, the session and its resources are no longer running.</p>
        max_results: <p>The maximum number of sessions to return.</p>
        next_token: <p>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 <code>NextToken</code> from the response object of the previous page call.</p>

    Raises:
        capo_athena.errors.internal_server_exception.InternalServerException: <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
        capo_athena.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
        capo_athena.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource, such as a workgroup, was not found.</p>
        capo_athena.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_athena.types.list_sessions_request.ListSessionsRequest]",
    ) -> OperationResponse[
        "capo_athena.types.list_sessions_response.ListSessionsResponse"
    ]:
        import capo_athena._operations.amazon_athena.list_sessions

        output, http_response = (
            capo_athena._operations.amazon_athena.list_sessions.list_sessions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListSessions")
    )
    input_: capo_athena.types.list_sessions_request.ListSessionsRequest = {
        "work_group": work_group
    }
    if state_filter is not None:
        input_["state_filter"] = state_filter
    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