Anaconda Enterprise: Documentation

# bokeh.application.handlers.server_lifecycle

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

class `bokeh.application.handlers.server_lifecycle.``ServerLifecycleHandler`(*args, **kwargs)

  Load a script which contains server lifecycle callbacks.

  `modify_document`(doc)

    This handler does not make any modifications to the Document.

    Parameters: | doc (Document) – A Bokeh Document to update in-place This handler does not modify the document
    Returns: | None

  `on_server_loaded`(server_context)

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

    Parameters: | server_context (ServerContext) –

  `on_server_unloaded`(server_context)

    Execute `on_server_unloaded` from the configured module (if it is defined) when the server cleanly exits. (Before stopping the server’s `IOLoop`.)

    Parameters: | server_context (ServerContext) –

    Warning

    In practice this code may not run, since servers are often killed by a signal.

  `on_session_created`(session_context)

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

    Parameters: | session_context (SessionContext) –

  `on_session_destroyed`(session_context)

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

    Parameters: | session_context (SessionContext) –

  `url_path`()

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

  `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