Acquiring streaming data externally from Bokeh

I am new to bokeh and I am trying to stream telemetry data to plots. Basically the same as discussed one year ago about plotting pressure transducer data. The problem that I am having with the examples is that they do a good job of generating data in the update call from the periodic callback. My data is external and queues and threads are good candidates for non-blocking acquisition.

Where I am really struggling is how to marry these two - it seems like the thread manager and periodic callback process interfere with each other as control loops need to be managed.

The Fourier plot and ohlc plots are good examples of a starting place for my plots. However, these generate data in the callback.

Is there any way of updating the plots without the periodic_callback? I would like to have new data in the queue push the update(s). Examples or explanation of how to achieve this would be greatly appreciated. I have been studying the existing documentation for over a week now - references to this will not likely help me much.

The periodic_callback might be okay if there some way to start and acquire data from the thread/queue or other interprocess communication scheme.

Thanks in advance.

This is definitely possible, and there are a range of possible approaches. I am afraid I only have the bandwidth to outline and offer pointers.

Generally speaking, Bokeh is built on Tornado. The "bokeh" command is a fairly lightweight script that just sets up the Bokeh Tornado app and some default endpoints and sets it all running. But you can embed Bokeh as a library in your own app:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library

There are various simple examples of that here:

  https://github.com/bokeh/bokeh/tree/master/examples/howto/server_embed

The main take-away from that is that if you do this then you can add your own Tornado request handlers, including async ones. The only thing to keep in mind is that you will probably have to schedule work to update Bokeh documents from async handlers in the same way as this section describes:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#updating-from-threads

For a more realistic concrete example of a Bokeh app that asynchronously collects network performance data from many clients to a single dashboard, you can look into the Dask dashboard. I don't know the details, but you can find the source code here:

  https://github.com/dask/distributed/tree/master/distributed/bokeh

Thanks,

Bryan

···

On Jan 25, 2018, at 13:29, JoeMac <[email protected]> wrote:

I am new to bokeh and I am trying to stream telemetry data to plots. Basically the same as discussed one year ago about plotting pressure transducer data. The problem that I am having with the examples is that they do a good job of generating data in the update call from the periodic callback. My data is external and queues and threads are good candidates for non-blocking acquisition.

Where I am really struggling is how to marry these two - it seems like the thread manager and periodic callback process interfere with each other as control loops need to be managed.

The Fourier plot and ohlc plots are good examples of a starting place for my plots. However, these generate data in the callback.

Is there any way of updating the plots without the periodic_callback? I would like to have new data in the queue push the update(s). Examples or explanation of how to achieve this would be greatly appreciated. I have been studying the existing documentation for over a week now - references to this will not likely help me much.

The periodic_callback might be okay if there some way to start and acquire data from the thread/queue or other interprocess communication scheme.

Thanks in advance.

--
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/643ebade-4455-496e-8de2-9cd60f9053d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.