bokeh.server.contexts#

Provides the Application, Server, and Session context classes.

class ApplicationContext(application: Application, io_loop: IOLoop | None = None, url: str | None = None, logout_url: str | None = None)[source]#
Server-side holder for bokeh.application.Application plus any associated data.

This holds data that’s global to all sessions, while ServerSession holds data specific to an “instance” of the application.

Public Data Attributes:

io_loop

application

url

server_context

sessions

Public Methods:

__init__(application[, io_loop, url, logout_url])

run_load_hook()

run_unload_hook()

create_session_if_needed(session_id[, ...])

get_session(session_id)


class BokehServerContext(application_context: ApplicationContext)[source]#
property sessions: list[ServerSession]#

SessionContext instances belonging to this application.

Subclasses must implement this method.

class BokehSessionContext(session_id: ID, server_context: ServerContext, document: Document, logout_url: str | None = None)[source]#
async with_locked_document(func: Callable[[Document], Awaitable[None]]) None[source]#

Runs a function with the document lock held, passing the document to the function.

Subclasses must implement this method.

Parameters:

func (callable) – function that takes a single parameter (the Document) and returns None or a Future

Returns:

a Future containing the result of the function

property destroyed: bool#

If True, the session has been discarded and cannot be used.

A new session with the same ID could be created later but this instance will not come back to life.