On Jun 8, 2017, at 21:12, [email protected] wrote:
Hello again,
I've tried a different approach:
@gen.coroutine
@without_document_lock
def update_plot_1(attrname, old, new):
...
@gen.coroutine
@without_document_lock
def update_plot_2(attrname, old, new):
...
def update_plots(attrname, old, new):
global doc
doc.add_next_tick_callback(partial(update_plot_1, attrname, old, new))
doc.add_next_tick_callback(partial(update_plot_2, attrname, old, new))
doc = currdoc()
my_select = Select(value='a', options=['a', 'b', 'c'])
my_select.on_change('value', update_plots)
Unfortunately I'm still getting the same undesired effect, i.e. the plots get updated in sequence. Is there no way to simultaneously/asynchronously update multiple plots in a same document? If so, is there a way to serve multiple sessions/documents (presumably one for each plot) from the same server, and if so what would the code look like based on my example above? Otherwise is the only way to serve each plot separately from a different server?
See also these similar threads:
• "Streaming Data to Multiple Documents Simultaneously": Redirecting to Google Groups
• "Plot on different documents at the same time": https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/snm3qxAIomI
On Wednesday, June 7, 2017 at 1:17:39 PM UTC-7, Julien Phalip wrote:
Hi,
I'm building a dashboard that contains multiple plots inside the same document. Each plot has a separate ColumnSource object attached to it. The data for each plot is retrieved with different SQL queries executed on a remote database server. The dashboard also has some controls (e.g. Select widgets) that allow the user to update those plots with different parameters.
Everything is working well, however all the plots are currently rendered synchronously in sequence (i.e. one after the other). This is especially problematic since each my DB queries are a bit slow and can take several seconds to execute. So when the user selects a different value in the controls, plots are updated in sequence at a few seconds interval.
Here's some pseudo code showing my use case:
def update_plots(attrname, old, new):
update_plot_1(attrname, old, new) # Causes a new DB request being executed (takes 2-3 seconds) followed by plot #1 being updated.
update_plot_2(attrname, old, new) # This causes plot #2 to be updated but is only executed once upload_plot_1() is completed.
my_select = Select(value='a', options=['a', 'b', 'c'])
my_select.on_change('value', update_plots)
In order to speed up the rendering process, I'd like to have all plots be updated simultaneously. Would you recommend some strategies for letting the on_change() control callbacks instruct multiple plots to be updated at the same time? Perhaps using Python multiprocessing or threading? Or should each plot perhaps live in a separate document and in separate Tornado connections?
Thanks a lot,
Julien
--
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/4631c0f9-2674-4fe2-8047-a1bb9d615c2d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.