I expect the Document will always be the basic unit of serialization of a Bokeh application, and I doubt sharing of actual Python Bokeh models in multiple documents will be supportable. That would break a bunch of foundational assumptions and the risk and work involved is simply to great. that said, I think there are still a number of potential avenues to explores:
* If the issue is simply more flexible layout of components, and otherwise everything could go in one app, then this issue is scheduled to be worked on soon:
It will allow a single bokeh app to template sub-components individually in user-defined templates. E.g. if you have a bunch of plots and widgets in one app but would rather use some more sophisticated JS layout library instead of Bokeh's layout, that will offer a path forward.
* If you do really need to synchronize between apps, this this implies some kind of external data store in any case, so. This data store might be a single in-memory object accessible by all sessions in a Bokeh server. The spectrogram example demonstrates this:
Alternatively, it might be outside the Bokeh server all together. In that case one might consider a new data source that can be configured to talk to the external data source, then different apps can be configured to talk to the same data backend, e.g. a database, or a REST API possibly. The AjaxDataSource is pretty much along these lines:
That happens to be built into Bokeh, but Bokeh is ver extensible so anyone could write a custom data source extension to talk to whatever actual backend they have. The docs for extending Bokeh are here:
Along similar lines if you want to really be able to share a data source e.g. in the browser across documents, a custom extension would be the way to go, because the specifics of the use-case will dictate how things should work.
On Jan 4, 2018, at 15:30, Paul Kairys <[email protected]> wrote:
I am tackling a streaming data project where I'd like to create a dashboard. I'd like to make it as modular as possible, i.e. multiple Applications. However, all the applications would require the same streaming data source, where I/O will be in another thread. And I am planning on embedding this into a custom template.
Looking through the documentation, it seems that most embedding is done via separate Application instances and separate documents can't share models. What would be the most straightforward way of sharing a single ColumnDataSource between the applications?
I have created a rough work-around where I create a single document and custom name each root._id. I then modified the server_document() source to include a model_id specification and embedded specific root models into my template.
Basically what I am asking is if there is an easier way of doing this. And, if maybe there should be a way to be very specific with the embedding options, because specifying each root._id could be a pain if there's a lot of them.
The attached code is what I've been playing around with. basically a modified example file.
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/33b0545d-9edb-453d-9950-8d56408ae2b8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.