Hi all,
I’m a brand new bokeh user and I’m hoping to use it for continuous plotting and computing. I’m toying with a piece of very simple code:
from bokeh.server.server import Server
from bokeh.application import Application
from bokeh.application.handlers.function import FunctionHandler
from bokeh.plotting import figure, ColumnDataSource
def make_document(doc):
fig = figure(title=‘Line plot!’, sizing_mode=‘scale_width’)
fig.line(x=[1, 2, 3], y=[1, 4, 9])
doc.title = “Hello, world!”
doc.add_root(fig)
apps = {‘/’: Application(FunctionHandler(make_document))}
server = Server(apps, port=5000)
server.start()
Using sleep to simulate computation
import time
time.sleep(100)
If I go to the localhost:5000 the browser would hang, whereas if I swap the server.start() with server.run_until_shutdown() I would be able to see the plot. How can I make the server run while I’m doing other computations? Eventually I would want to add computation and asynchronous update to the plot, so this is important to me. Thank you Bokeh community!
Best,
Daran