Hi,
I have a Bokeh Server application that, on start up, creates a Figure and ultimately adds 10 Lines to it. Each line has about 300,000 points. The total set of work I need to do then is:
def build_figure(data, fig):
# data = [ line1_data, line2_data, ... ]
for i in range(10):
cds = ColumnDataSource(data[i])
fig.line('x', 'y', source=cds, name=f'line {i}')
curdoc().add_next_tick_callback(partial(build_figure, data, fig))
However, this takes several seconds during which the screen is blank and there is no visual indication of progress. Instead, I would like to
I would instead like to break this work into individual callbacks, one for each Line:
def build_line(line_data, name, fig):
# line_data = { 'x': ..., 'y': ... }
cds = ColumnDataSource(line_data)
fig.line('x', 'y', source=cds, name=name)
for i in range(10):
curdoc().add_next_tick_callback(
partial(build_line, data[i], f'line {i}', fig)
)
However, this doesn’t seem to solve the problem. It appears (not surprisingly) that all of the 10 callbacks are executed on the next tick.
I would like to somehow schedule these callbacks serially, so that only one runs at a time. What is the best practice for achieving something like this?
Thanks again,
Henry