Hi, is it possible to render different pages with the same server? I mean multiple figure/widgets (noproblem if they have different URL) sharing the same data on server side.
Yes and no. You can’t share Bokeh models themselves (e.g. a
ColumnDataSource) between different
Document objects, and if you are running multiple apps on a Bokeh server (which is how you get multiple pages/URLs), then you will have different documents.
However, there is nothing to prevent sharing anything else between apps, e.g. NumPy arrays or Pandas DataFrames or whatever. There’s different ways you might do this, but the simplest is just to leverage Python’s standard module caching behaviour: Make a
data.py module that has a module-level attribute (a “global”) with the data object. Then every Bokeh app on the server that imports the
data.py module will get the same copy.
Naturally, this work simplest and best if everyone only needs read-only access. If the different apps will also be updating the data (or if some thread is updating it separately, etc) then you would probably need synchronization of some sort.
This all only applies to a single Bokeh server process. If you are using
--num-procsor running mulitple instances behind a load balancer, etc. then you would need something like an external database in order to share things across processes.
thanks for your reply. I will try to be more clear.
My need is to have one (or more if required) bokeh server running in background.
I have one scatter plot in one page where I can select one single point.
This point represent a simulation and I have a lot of data to display.
So, from this page I get the run ID and then I retrive all the data from other files and plot the specific run data in another page with many figures, and interactive widgets.
The point of asking how to share data between pages (I can do this easily by using a tab widget on top of all to resolve the specific problem) is in order to create a more complex webapp.
Basically, I would like to have a bokeh server running in background to manage all the callbacks and a frontend like jupyterlab, the point is to have floating sub containers wich incorporate multiple pages (composition of figures and widgets which interact with the server to retreive data e update the ColumnDataSources ) generated by (multiple/one)-bokeh server.
Do you have any example of embedding multiple (at least 2) bokeh pages into the lumino interface?
I think this will be very usefull for the community to help/guide the development of state-of-the-art web applications (for scientific pupuses). Bokeh is fantastic as well as the jupyterlab interface, togheter the can be the killer-apps environmento for quick development.
Of course I can try to do a jupyterlab extension but i do not want to have all the core extension of jupyterlab into my webapp.