bokeh.server.tornado (original) (raw)

Provides the Bokeh Server Tornado application.

class BokehTornado(applications: Mapping[str, Application | ModifyDoc] | Application | ModifyDoc, *, absolute_url: str | None = None, prefix: str | None = None, extra_websocket_origins: Sequence[str] | None = None, extra_patterns: URLRoutes | None = None, secret_key: bytes | None = None, sign_sessions: bool = False, generate_session_ids: bool = True, keep_alive_milliseconds: int = 37000, check_unused_sessions_milliseconds: int = 17000, unused_session_lifetime_milliseconds: int = 15000, stats_log_frequency_milliseconds: int = 15000, mem_log_frequency_milliseconds: int = 0, use_index: bool = True, redirect_root: bool = True, websocket_max_message_size_bytes: int = 20971520, websocket_compression_level: int | None = None, websocket_compression_mem_level: int | None = None, ico_path: str = '/home/runner/miniconda3/envs/bk-release-build/lib/python3.10/site-packages/bokeh/server/views/bokeh.ico', index: str | None = None, auth_provider: AuthProvider = <bokeh.server.auth_provider.NullAuth object>, xsrf_cookies: bool = False, include_headers: list[str] | None = None, include_cookies: list[str] | None = None, exclude_headers: list[str] | None = None, exclude_cookies: list[str] | None = None, session_token_expiration: int = 300, **kwargs: Any)[source]#

A Tornado Application used to implement the Bokeh Server.

Parameters:

Any additional keyword arguments are passed to tornado.web.Application.

get_session(app_path: str, session_id: ID) → ServerSession[source]#

Get an active a session by name application path and session ID.

Parameters:

Returns:

ServerSession

get_sessions(app_path: str) → list[ServerSession][source]#

Gets all currently active sessions for an application.

Parameters:

app_path (str) – The configured application path for the application to return sessions for.

Returns:

list[ServerSession]

initialize(io_loop: IOLoop) → None[source]#

Start a Bokeh Server Tornado Application on a given Tornado IOLoop.

resources(absolute_url: str | bool | None = None) → Resources[source]#

Provide a Resources that specifies where Bokeh application sessions should load BokehJS resources from.

Parameters:

absolute_url (str, bool) – An absolute URL prefix to use for locating resources. IfTrue, a prefix consisting of server’s protocol, host and port will be used. Otherwise, root-relative URLs are used (default: None)

start() → None[source]#

Start the Bokeh Server application.

Starting the Bokeh Server Tornado application will run periodic callbacks for stats logging, cleanup, pinging, etc. Additionally, any startup hooks defined by the configured Bokeh applications will be run.

stop(wait: bool = True) → None[source]#

Stop the Bokeh Server application.

Parameters:

wait (bool) – whether to wait for orderly cleanup (default: True)

Returns:

None

property app_paths_: set[str]_#

A list of all application paths for all Bokeh applications configured on this Bokeh server instance.

property applications_: Mapping[str, ApplicationContext]_#

The configured applications

property exclude_cookies_: list[str] | None_#

A list of request cookies to exclude in the session context.

A list of request headers to exclude in the session context.

property generate_session_ids_: bool_#

Whether this Bokeh Server Tornado Application has been configured to automatically generate session IDs.

property icon_: bytes | None_#

Favicon.ico file data, or None

property include_cookies_: list[str] | None_#

A list of request cookies to make available in the session context.

A list of request headers to make available in the session context.

property index_: str | None_#

Path to a Jinja2 template to serve as the index “/”

property io_loop_: IOLoop_#

The Tornado IOLoop that this Bokeh Server Tornado Application is running on.

property prefix_: str_#

A URL prefix for this Bokeh Server Tornado Application to use for all paths

property secret_key_: bytes | None_#

A secret key for this Bokeh Server Tornado Application to use when signing session IDs, if configured.

property session_token_expiration_: int_#

Duration in seconds that a new session token is valid for session creation.

After the expiry time has elapsed, the token will not be able create a new session.

property sign_sessions_: bool_#

Whether this Bokeh Server Tornado Application has been configured to cryptographically sign session IDs

If True, then secret_key must also have been configured.

property websocket_origins_: set[str]_#

A list of websocket origins permitted to connect to this server.