Skip to content

list_notebook_sessions async

list_notebook_sessions(
    notebook_id: NotebookId,
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    max_results: Optional[MaxSessionsCount] = None,
    next_token: Optional[Token] = None,
) -> ListNotebookSessionsResponse

Lists, in descending order, the sessions that have been created in a notebook that are in an active state like CREATING, CREATED, IDLE or BUSY. Newer sessions are listed first; older sessions are listed later.

Parameters:

  • notebook_id (NotebookId) –

    The ID of the notebook to list sessions for.

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

    The maximum number of notebook sessions to return.

  • next_token (Optional[Token], 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/async_athena.py
async def list_notebook_sessions(
    self,
    notebook_id: "capo_athena.types.notebook_id.NotebookId",
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    max_results: Optional[
        "capo_athena.types.max_sessions_count.MaxSessionsCount"
    ] = None,
    next_token: Optional["capo_athena.types.token.Token"] = None,
) -> (
    "capo_athena.types.list_notebook_sessions_response.ListNotebookSessionsResponse"
):
    """<p>Lists, in descending order, the sessions that have been created in a notebook 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:
        notebook_id: <p>The ID of the notebook to list sessions for.</p>
        max_results: <p>The maximum number of notebook 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_athena.types.list_notebook_sessions_request.ListNotebookSessionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_athena.types.list_notebook_sessions_response.ListNotebookSessionsResponse"
    ]:
        import capo_athena._operations.amazon_athena.list_notebook_sessions

        (
            output,
            http_response,
        ) = await capo_athena._operations.amazon_athena.list_notebook_sessions.async_list_notebook_sessions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListNotebookSessions")
    )
    input_: capo_athena.types.list_notebook_sessions_request.ListNotebookSessionsRequest = {
        "notebook_id": notebook_id
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output