Not possible to load pre-existing bokeh .html pages into bokeh server?

I am currently developing a dashboard for data analysis. We are using bokeh server to dynamically display data from various data sources.

The plots are the result of a computationally intensive process (binning, transformations, averaging, etc…). It is not possible to store the data in a file for later use by the server as the size requirement would be too great. Instead we save these plots as we go.

Is there a way that these plots could be incorporated into bokeh server by loading the plots directly from an HTML file? If not, are there any suggestions on how I should go about solving this issue?

The description is fairly vague, but here are some comments:

If it has to be saved as a full HTML file then your best bet is probably using an <iframe> to embed the HTML files. AFAIK you could put iframes in Bokeh Div objects, or you could accomplish with a custom Jinja template too, probably,

If there’s not actually a requirement to save as HTML, then the plots could also be exported as JSON using the json_item API, then embedded in the final page using the BokehJS embed_item function. I’d regard this as a “cleaner” solution, since it stores purely the representation of the plot.

If there is not any actual interactivity baked into the plot (hover, etc) then you could also export the pots as PNGs to display.

I definitely agree with you. Sorry I tried to keep my description short. We are using the bokeh server module rather than a webserver to handle everything (as it is just an internal tool) and our understanding is that you can only display bokeh plots on it?

Also I realized that we can just save the plots as pickles and then load them up that way in the bokeh server too! That might be the ‘best’ solution for anyone else who has this same issue.

Also I realized that we can just save the plots as pickles and then load them up that way in the bokeh server too

Word of caution about that approach. All Bokeh object in a given Document must be unique. By default Bokeh just starts a simple counting sequence to assign IDs which works fine in a single process. If you are contributing Bokeh objects from mulitple processes, you really probably will have to set the “simple IDs” setting to False to generate unique UUIDs that will not collide even across process boundaries.

1 Like

Thank you so much for that help!