This docs on this page refers to a PREVIOUS VERSION. For the latest stable release, go to https://docs.bokeh.org/

Archived docs for versions <= 1.0.4 have had to be modified from their original published configuration, and may be missing some features (e.g. source listing)

All users are encourage to update to version 1.1 or later, as soon as they are able.

bokeh.document.locking — Bokeh 1.0.3 documentation

bokeh.document.locking

class UnlockedDocumentProxy(doc)[source]

Wrap a Document object so that only methods that can safely be used from unlocked callbacks or threads are exposed. Attempts to otherwise access or change the Document results in an exception.

__init__(doc)[source]
add_next_tick_callback(callback)[source]

Add a “next tick” callback.

Parameters:callback (callable) –
remove_next_tick_callback(callback)[source]

Remove a “next tick” callback.

Parameters:callback (callable) –
without_document_lock(func)[source]

Wrap a callback function to execute without first obtaining the document lock.

Parameters:func (callable) – The function to wrap
Returns:a function wrapped to execute without a Document lock.
Return type:callable

While inside an unlocked callback, it is completely unsafe to modify curdoc(). The value of curdoc() inside the callback will be a specially wrapped version of Document that only allows safe operations, which are:

  • add_next_tick_callback()
  • remove_next_tick_callback()

Only these may be used safely without taking the document lock. To make other changes to the document, you must add a next tick callback and make your changes to curdoc() from that second callback.

Attempts to otherwise access or change the Document will result in an exception being raised.