bokeh.application.handlers.server_lifecycle#

Bokeh Application Handler to look for Bokeh server lifecycle callbacks in a specified Python module.

class ServerLifecycleHandler(*, filename: PathLike, argv: list[str] = [], package: ModuleType | None = None)[source]#

Load a script which contains server lifecycle callbacks.

Public Data Attributes:

error

If the handler fails, may contain a related error message.

error_detail

If the handler fails, may contain a traceback or other details.

failed

True if the lifecycle callbacks failed to execute

Inherited from : py: class:LifecycleHandler

safe_to_fork

Inherited from : py: class:Handler

error

If the handler fails, may contain a related error message.

error_detail

If the handler fails, may contain a traceback or other details.

failed

True if the lifecycle callbacks failed to execute

safe_to_fork

Public Methods:

__init__(*, filename[, argv, package])

keyword filename:

path to a module to load lifecycle callbacks from

url_path()

The last path component for the basename of the path to the callback module.

Inherited from : py: class:LifecycleHandler

__init__(*, filename[, argv, package])

keyword filename:

path to a module to load lifecycle callbacks from

modify_document(doc)

This handler does not make any modifications to the Document.

on_server_loaded(server_context)

Execute on_server_unloaded` from the configured module (if it is defined) when the server is first started.

on_server_unloaded(server_context)

Execute on_server_unloaded from the configured module (if it is defined) when the server cleanly exits.

on_session_created(session_context)

Execute on_session_created from the configured module (if it is defined) when a new session is created.

on_session_destroyed(session_context)

Execute on_session_destroyed from the configured module (if it is defined) when a new session is destroyed.

Inherited from : py: class:Handler

__init__(*, filename[, argv, package])

keyword filename:

path to a module to load lifecycle callbacks from

modify_document(doc)

This handler does not make any modifications to the Document.

on_server_loaded(server_context)

Execute on_server_unloaded` from the configured module (if it is defined) when the server is first started.

on_server_unloaded(server_context)

Execute on_server_unloaded from the configured module (if it is defined) when the server cleanly exits.

on_session_created(session_context)

Execute on_session_created from the configured module (if it is defined) when a new session is created.

on_session_destroyed(session_context)

Execute on_session_destroyed from the configured module (if it is defined) when a new session is destroyed.

process_request(request)

Processes incoming HTTP request returning a dictionary of additional data to add to the session_context.

static_path()

Return a path to app-specific static resources, if applicable.

url_path()

The last path component for the basename of the path to the callback module.


__init__(*, filename: PathLike, argv: list[str] = [], package: ModuleType | None = None) None[source]#
Keyword Arguments:
  • filename (str) – path to a module to load lifecycle callbacks from

  • argv (list[str], optional) – a list of string arguments to use as sys.argv when the callback code is executed. (default: [])

url_path() str | None[source]#

The last path component for the basename of the path to the callback module.

property error: str | None#

If the handler fails, may contain a related error message.

property error_detail: str | None#

If the handler fails, may contain a traceback or other details.

property failed: bool#

True if the lifecycle callbacks failed to execute