bokeh.server.application_context¶
Provides the ApplicationContext
class.
-
class
ApplicationContext
(application, io_loop=None, url=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.
-
class
BokehServerContext
(application_context)[source]¶ -
add_next_tick_callback
(callback)[source]¶ Add a callback to be run on the next tick of the event loop.
Subclasses must implement this method.
Parameters: callback (callable) – a callback to add
The callback will execute on the next tick of the event loop, and should have the form
def callback()
(i.e. it should not accept any arguments)Returns: an ID that can be used with remove_next_tick_callback
.
-
add_periodic_callback
(callback, period_milliseconds)[source]¶ Add a callback to be run periodically until it is removed.
Subclasses must implement this method.
Parameters: - callback (callable) –
a callback to add
The callback will execute periodically on the event loop as specified, and should have the form
def callback()
(i.e. it should not accept any arguments) - period_milliseconds (int) – number of milliseconds to wait between executing the callback.
Returns: an ID that can be used with
remove_periodic_callback
.- callback (callable) –
-
add_timeout_callback
(callback, timeout_milliseconds)[source]¶ Add a callback to be run once after timeout_milliseconds.
Subclasses must implement this method.
Parameters: - callback (callable) –
a callback to add
The callback will execute once on the event loop after the timeout has passed, and should have the form
def callback()
(i.e. it should not accept any arguments) - timeout_milliseconds (int) – number of milliseconds to wait before executing the callback.
Returns: an ID that can be used with
remove_timeout_callback
.- callback (callable) –
-
remove_next_tick_callback
(callback_id)[source]¶ Remove a callback added with
add_next_tick_callback
, before it runs.Subclasses must implement this method.Parameters: callback_id – the ID returned from add_next_tick_callback
-
remove_periodic_callback
(callback_id)[source]¶ Removes a callback added with
add_periodic_callback
.Subclasses must implement this method.
Parameters: callback_id – the ID returned from add_periodic_callback
-
remove_timeout_callback
(callback_id)[source]¶ Remove a callback added with
add_timeout_callback
, before it runs.Subclasses must implement this method.
Parameters: callback_id – the ID returned from add_timeout_callback
-
sessions
¶ SessionContext instances belonging to this application.
Subclasses must implement this method.
-
-
class
BokehSessionContext
(session_id, server_context, document)[source]¶ -
with_locked_document
(func)[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 aFuture
Returns: a Future
containing the result of the function
-
destroyed
¶ 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.
-