Passing data from a server to a session document

(repost to change title)

I’m attempting to change a ColumnDataSource’s data from outside the bokeh document by calling:

ses._document.select_one({'name':'source'}).data = {'dat':new_data} #line 61 in server.py #ses is of type 'bokeh.server.session.ServerSession' #new_data is a list

or

ses._document.select_one({'name':'source'}).stream({'dat':new_data})

I’m calling it from a class containing a bokeh server run programatically. When I try to change it, I get the runtime error (the full traceback can be found in a text file in the zip):

_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

I understand that I’m using bokeh in an unconventional way, but being able to do this would really help my process along. Any help would be much appreciated.

(Also, if pointed in the right direction, I’d be willing, and to add a new feature that would make accomplishing this easier for future users)

pass_to_source.zip (2.49 KB)

Traveling until Monday but quickly: you will have to schedule a next tick callback, and do the doc modifying work in the callback. That’s the only safe way to accomplish this. There are examples in the users guide server section.

···

On Aug 20, 2016, at 15:10, Adam Hubbell [email protected] wrote:

(repost to change title)

I’m attempting to change a ColumnDataSource’s data from outside the bokeh document by calling:

ses._document.select_one({'name':'source'}).data = {'dat':new_data} #line 61 in server.py #ses is of type 'bokeh.server.session.ServerSession' #new_data is a list

or

ses._document.select_one({'name':'source'}).stream({'dat':new_data})

I’m calling it from a class containing a bokeh server run programatically. When I try to change it, I get the runtime error (the full traceback can be found in a text file in the zip):

_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

I understand that I’m using bokeh in an unconventional way, but being able to do this would really help my process along. Any help would be much appreciated.

(Also, if pointed in the right direction, I’d be willing, and to add a new feature that would make accomplishing this easier for future users)

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/af3ad12b-f2b7-4c22-9ed5-2651e294bcab%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<pass_to_source.zip>

Thanks! That worked out beautifully.

solution attached for those who may want it.

pass_to_source_working.zip (2.61 KB)

···

On Saturday, August 20, 2016 at 5:10:47 PM UTC-5, Adam Hubbell wrote:

(repost to change title)

I’m attempting to change a ColumnDataSource’s data from outside the bokeh document by calling:

ses._document.select_one({'name':'source'}).data = {'dat':new_data} #line 61 in server.py #ses is of type 'bokeh.server.session.ServerSession' #new_data is a list

or

ses._document.select_one({'name':'source'}).stream({'dat':new_data})

I’m calling it from a class containing a bokeh server run programatically. When I try to change it, I get the runtime error (the full traceback can be found in a text file in the zip):

_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

I understand that I’m using bokeh in an unconventional way, but being able to do this would really help my process along. Any help would be much appreciated.

(Also, if pointed in the right direction, I’d be willing, and to add a new feature that would make accomplishing this easier for future users)