Runtime error with new bokeh server

Using the new bokeh server, I frequently get an error that looks something like this:

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can anyone give me an idea of where this error could be coming from?

I’d paste the full traceback, but it’s 11,000 line long, mostly alternating between errors in gen.py and concurrent.py. Here are the last few lines:

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1017, in run

yielded = self.gen.send(value)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 351, in _handle_messages

self._session._handle_patch(message)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/session.py”, line 364, in _handle_patch

message.apply_to_document(self.document)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/server/protocol/messages/patch_doc.py”, line 80, in apply_to_document

doc.apply_json_patch(self.content)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/document.py”, line 837, in apply_json_patch

raise RuntimeError(“Cannot apply patch to %s which is not in the document” % (str(patched_id)))

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can you possibly share a code sample (ideally complete and runnable that reproduces the problem)? Also how are you using the server: to run app (i.e. “bokeh serve”), or are you connecting with the python client (i.e “push_session”) from a notebook or a script?

I’m going to make a guess its the latter. The message is saying that you are trying to update a Bokeh model on the server that does not exist on the server already.

···

On Jan 9, 2016, at 11:15, [email protected] wrote:

Using the new bokeh server, I frequently get an error that looks something like this:

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can anyone give me an idea of where this error could be coming from?

I’d paste the full traceback, but it’s 11,000 line long, mostly alternating between errors in gen.py and concurrent.py. Here are the last few lines:

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1017, in run

yielded = self.gen.send(value)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 351, in _handle_messages

self._session._handle_patch(message)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/session.py”, line 364, in _handle_patch

message.apply_to_document(self.document)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/server/protocol/messages/patch_doc.py”, line 80, in apply_to_document

doc.apply_json_patch(self.content)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/document.py”, line 837, in apply_json_patch

raise RuntimeError(“Cannot apply patch to %s which is not in the document” % (str(patched_id)))

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

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/a138c933-f24e-4ea1-8d71-063b199a74aa%40continuum.io.

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

I’m using push_session. The code as it stands now isn’t runnable without access to our internal databases. From what you describe, I think the problem probably has to do with a GridPlot I use in one part of the app. Depending on the value of a particular Select widget, that GridPlot can be populated with anywhere from one to 14 children. So when a new selection is made, I create the new plots and add them as children. Those Plots wouldn’t be in the model that I originally pushed to the server, so it would make sense that they were the source of the problem. What’s the appropriate way to handle that sort of use case?

···

On Saturday, January 9, 2016 at 12:21:48 PM UTC-5, Bryan Van de ven wrote:

Can you possibly share a code sample (ideally complete and runnable that reproduces the problem)? Also how are you using the server: to run app (i.e. “bokeh serve”), or are you connecting with the python client (i.e “push_session”) from a notebook or a script?

I’m going to make a guess its the latter. The message is saying that you are trying to update a Bokeh model on the server that does not exist on the server already.

On Jan 9, 2016, at 11:15, [email protected] wrote:

Using the new bokeh server, I frequently get an error that looks something like this:

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can anyone give me an idea of where this error could be coming from?

I’d paste the full traceback, but it’s 11,000 line long, mostly alternating between errors in gen.py and concurrent.py. Here are the last few lines:

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1017, in run

yielded = self.gen.send(value)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 351, in _handle_messages

self._session._handle_patch(message)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/session.py”, line 364, in _handle_patch

message.apply_to_document(self.document)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/server/protocol/messages/patch_doc.py”, line 80, in apply_to_document

doc.apply_json_patch(self.content)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/document.py”, line 837, in apply_json_patch

raise RuntimeError(“Cannot apply patch to %s which is not in the document” % (str(patched_id)))

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

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/a138c933-f24e-4ea1-8d71-063b199a74aa%40continuum.io.

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

I think (with some possible weird exceptions) that if you see this error it’s a bokeh bug. When you add/remove models the other side of the connection should be tracking those adds and removes. The question is why it isn’t.

The thing to do is get it down to a relatively simple app (or even better, unit test) showing the issue and then file an issue (or debug it, if feeling enterprising). If we can see the bug in action we can figure out what happens here.

Havoc

···

On Jan 9, 2016, at 9:50 PM, [email protected] wrote:

I’m using push_session. The code as it stands now isn’t runnable without access to our internal databases. From what you describe, I think the problem probably has to do with a GridPlot I use in one part of the app. Depending on the value of a particular Select widget, that GridPlot can be populated with anywhere from one to 14 children. So when a new selection is made, I create the new plots and add them as children. Those Plots wouldn’t be in the model that I originally pushed to the server, so it would make sense that they were the source of the problem. What’s the appropriate way to handle that sort of use case?

On Saturday, January 9, 2016 at 12:21:48 PM UTC-5, Bryan Van de ven wrote:

Can you possibly share a code sample (ideally complete and runnable that reproduces the problem)? Also how are you using the server: to run app (i.e. “bokeh serve”), or are you connecting with the python client (i.e “push_session”) from a notebook or a script?

I’m going to make a guess its the latter. The message is saying that you are trying to update a Bokeh model on the server that does not exist on the server already.

On Jan 9, 2016, at 11:15, [email protected] wrote:

Using the new bokeh server, I frequently get an error that looks something like this:

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can anyone give me an idea of where this error could be coming from?

I’d paste the full traceback, but it’s 11,000 line long, mostly alternating between errors in gen.py and concurrent.py. Here are the last few lines:

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1017, in run

yielded = self.gen.send(value)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 351, in _handle_messages

self._session._handle_patch(message)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/session.py”, line 364, in _handle_patch

message.apply_to_document(self.document)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/server/protocol/messages/patch_doc.py”, line 80, in apply_to_document

doc.apply_json_patch(self.content)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/document.py”, line 837, in apply_json_patch

raise RuntimeError(“Cannot apply patch to %s which is not in the document” % (str(patched_id)))

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

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/a138c933-f24e-4ea1-8d71-063b199a74aa%40continuum.io.

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

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/d8ee096c-4946-4c5e-9f9b-6b820332cb4f%40continuum.io.

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

I’m trying to narrow the thing down to a simple reproducible example. In the meantime, I noticed that that huge traceback in python is accompanied by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: “Rect”, id: “1c4b5b15-ab50-40a4-a9e0-06488cd3301a”}

Does that suggest anything to you?

···

On Sunday, January 10, 2016 at 10:09:15 AM UTC-5, Havoc Pennington wrote:

I think (with some possible weird exceptions) that if you see this error it’s a bokeh bug. When you add/remove models the other side of the connection should be tracking those adds and removes. The question is why it isn’t.

The thing to do is get it down to a relatively simple app (or even better, unit test) showing the issue and then file an issue (or debug it, if feeling enterprising). If we can see the bug in action we can figure out what happens here.

Havoc

On Jan 9, 2016, at 9:50 PM, [email protected] wrote:

I’m using push_session. The code as it stands now isn’t runnable without access to our internal databases. From what you describe, I think the problem probably has to do with a GridPlot I use in one part of the app. Depending on the value of a particular Select widget, that GridPlot can be populated with anywhere from one to 14 children. So when a new selection is made, I create the new plots and add them as children. Those Plots wouldn’t be in the model that I originally pushed to the server, so it would make sense that they were the source of the problem. What’s the appropriate way to handle that sort of use case?

On Saturday, January 9, 2016 at 12:21:48 PM UTC-5, Bryan Van de ven wrote:

Can you possibly share a code sample (ideally complete and runnable that reproduces the problem)? Also how are you using the server: to run app (i.e. “bokeh serve”), or are you connecting with the python client (i.e “push_session”) from a notebook or a script?

I’m going to make a guess its the latter. The message is saying that you are trying to update a Bokeh model on the server that does not exist on the server already.

On Jan 9, 2016, at 11:15, [email protected] wrote:

Using the new bokeh server, I frequently get an error that looks something like this:

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

Can anyone give me an idea of where this error could be coming from?

I’d paste the full traceback, but it’s 11,000 line long, mostly alternating between errors in gen.py and concurrent.py. Here are the last few lines:

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 355, in _handle_messages

yield self._next()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 302, in _next

yield self._state.run(self)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1014, in run

yielded = self.gen.throw(*exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 81, in run

yield connection._handle_messages()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1008, in run

value = future.result()

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/concurrent.py”, line 232, in result

raise_exc_info(self._exc_info)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/tornado/gen.py”, line 1017, in run

yielded = self.gen.send(value)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/connection.py”, line 351, in _handle_messages

self._session._handle_patch(message)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/client/session.py”, line 364, in _handle_patch

message.apply_to_document(self.document)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/server/protocol/messages/patch_doc.py”, line 80, in apply_to_document

doc.apply_json_patch(self.content)

File “//anaconda/envs/bokeh11/lib/python2.7/site-packages/bokeh/document.py”, line 837, in apply_json_patch

raise RuntimeError(“Cannot apply patch to %s which is not in the document” % (str(patched_id)))

RuntimeError: Cannot apply patch to 535f7529-6e5d-4585-bb08-c72687486f0b which is not in the document

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]um.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a138c933-f24e-4ea1-8d71-063b199a74aa%40continuum.io.

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

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/d8ee096c-4946-4c5e-9f9b-6b820332cb4f%40continuum.io.

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

Nothing offhand - this error message is a "should not happen" kind of
thing, where somehow the two sides of the client/server connection have
become desynced and don't know about the same objects. Presumably the cause
is a bug, but I don't know what the bug is. It may be fairly easy to figure
out given a way to reproduce it.

Havoc

···

On Mon, Jan 11, 2016 at 4:38 PM, <[email protected]> wrote:

I'm trying to narrow the thing down to a simple reproducible example. In
the meantime, I noticed that that huge traceback in python is accompanied
by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: "Rect", id:
"1c4b5b15-ab50-40a4-a9e0-06488cd3301a"}

Does that suggest anything to you?

Hi all,

I’m having a similar problem while using the bokeh client: whenever I make a change to the structure of a document, I get a javascript log message about an unknown model, and one or more error messages that read:

“Bokeh: Error handling message”

``

I’ve created a fairly small test case:

Launch the server:

bokeh serve --host localhost:5006

``

On the same machine, run the following python script:

import numpy

import bokeh.client
import bokeh.plotting
import bokeh.models.widgets

doc = bokeh.plotting.curdoc()
session = bokeh.client.push_session(doc)

checkboxes = bokeh.models.widgets.CheckboxButtonGroup(labels = [“one”])

layout = bokeh.models.widgets.VBoxForm(children = [checkboxes])
doc.add_root(layout)

class Updater(object):

def __init__(self):
    self.__plot = None
   
def __call__(self, *args, **kwargs):
    if self.__plot is not None:
        doc.remove_root(self.__plot)
    self.__plot = bokeh.plotting.Figure()
    self.__plot.line(x = range(4), y = numpy.random.randn(4))
    doc.add_root(self.__plot)

update = Updater()
checkboxes.on_click(update)

session.loop_until_closed()

``

Once both are running, I open a web browser on the same machine and go to http://localhost:5006/?bokeh-session-id=, where is the UID printed in the bokeh server log. The browser will display a single button, and when you click on it, you’ll get the following message in the browser console, where is the hex UID for the model:

"Got an event for unknown model " Object { subtype: “Figure”, type: “Plot”, id: “” }

``

You also get the error “Bokeh: Error handling message” with a stack trace (this is from firefox):

"Bokeh: Error handling message " bokeh.min.js:63:12556
Bokeh</<.jsnlog</</k</n.prototype.cerror() bokeh.min.js:63
Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.sendBatch() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.error() bokeh.min.js:63
Bokeh</<[“common/client”]</r</t.prototype._on_message() bokeh.min.js:2
Bokeh</<[“common/client”]</r</t.prototype.connect/</</t.socket.onmessage() bokeh.min.js:1

``

If you then reload the page, you will see the plot displayed correctly under the button. If you click the button again, the same thing happens: the plot doesn’t update, you get a similar log-message/stack-trace in the console, and once you reload a second time, you see the new plot.

Am I doing something wrong here, or does this seem like a bug? I am using version 0.11.0.

Are there any alternative ways to achieve a similar result? For example, I considered adding/removing lines from the Figure, and while adding lines from the on_click callback is straightforward, it’s not obvious how to remove a line. Is that possible?

Thanks,

Peter

···

On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc Pennington wrote:

On Mon, Jan 11, 2016 at 4:38 PM, [email protected] wrote:

I’m trying to narrow the thing down to a simple reproducible example. In the meantime, I noticed that that huge traceback in python is accompanied by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: “Rect”, id: “1c4b5b15-ab50-40a4-a9e0-06488cd3301a”}

Does that suggest anything to you?

Nothing offhand - this error message is a “should not happen” kind of thing, where somehow the two sides of the client/server connection have become desynced and don’t know about the same objects. Presumably the cause is a bug, but I don’t know what the bug is. It may be fairly easy to figure out given a way to reproduce it.

Havoc

Regarding how to “remove” a line, I had a related need the other day where I needed to be able to make a line disappear and then reappear based on the state of a checkbox (see https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E). What I ended up doing is setting line.glyph.line_alpha = 0.0 when I wanted the line to disappear, and line.glyph.line_alpha = 1.0 when it should be visible.

Greg

···

On Thursday, January 14, 2016 at 8:26:33 PM UTC-7, [email protected] wrote:

Hi all,

I’m having a similar problem while using the bokeh client: whenever I make a change to the structure of a document, I get a javascript log message about an unknown model, and one or more error messages that read:

“Bokeh: Error handling message”

``

I’ve created a fairly small test case:

Launch the server:

bokeh serve --host localhost:5006

``

On the same machine, run the following python script:

import numpy

import bokeh.client
import bokeh.plotting
import bokeh.models.widgets

doc = bokeh.plotting.curdoc()
session = bokeh.client.push_session(doc)

checkboxes = bokeh.models.widgets.CheckboxButtonGroup(labels = [“one”])

layout = bokeh.models.widgets.VBoxForm(children = [checkboxes])
doc.add_root(layout)

class Updater(object):

def __init__(self):
    self.__plot = None
   
def __call__(self, *args, **kwargs):
    if self.__plot is not None:
        doc.remove_root(self.__plot)
    self.__plot = bokeh.plotting.Figure()
    self.__plot.line(x = range(4), y = numpy.random.randn(4))
    doc.add_root(self.__plot)

update = Updater()
checkboxes.on_click(update)

session.loop_until_closed()

``

Once both are running, I open a web browser on the same machine and go to http://localhost:5006/?bokeh-session-id=, where is the UID printed in the bokeh server log. The browser will display a single button, and when you click on it, you’ll get the following message in the browser console, where is the hex UID for the model:

"Got an event for unknown model " Object { subtype: “Figure”, type: “Plot”, id: “” }

``

You also get the error “Bokeh: Error handling message” with a stack trace (this is from firefox):

"Bokeh: Error handling message " bokeh.min.js:63:12556
Bokeh</<.jsnlog</</k</n.prototype.cerror() bokeh.min.js:63
Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.sendBatch() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.error() bokeh.min.js:63
Bokeh</<[“common/client”]</r</t.prototype._on_message() bokeh.min.js:2
Bokeh</<[“common/client”]</r</t.prototype.connect/</</t.socket.onmessage() bokeh.min.js:1

``

If you then reload the page, you will see the plot displayed correctly under the button. If you click the button again, the same thing happens: the plot doesn’t update, you get a similar log-message/stack-trace in the console, and once you reload a second time, you see the new plot.

Am I doing something wrong here, or does this seem like a bug? I am using version 0.11.0.

Are there any alternative ways to achieve a similar result? For example, I considered adding/removing lines from the Figure, and while adding lines from the on_click callback is straightforward, it’s not obvious how to remove a line. Is that possible?

Thanks,

Peter

On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc Pennington wrote:

On Mon, Jan 11, 2016 at 4:38 PM, [email protected] wrote:

I’m trying to narrow the thing down to a simple reproducible example. In the meantime, I noticed that that huge traceback in python is accompanied by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: “Rect”, id: “1c4b5b15-ab50-40a4-a9e0-06488cd3301a”}

Does that suggest anything to you?

Nothing offhand - this error message is a “should not happen” kind of thing, where somehow the two sides of the client/server connection have become desynced and don’t know about the same objects. Presumably the cause is a bug, but I don’t know what the bug is. It may be fairly easy to figure out given a way to reproduce it.

Havoc

That makes sense. I was starting to suspect that I would have to use the .visible property to make this work (although from your linked discussion it seems that won’t work either); setting the line_alpha is a reasonable substitute.

I’d also be fine replacing the entire Figure in the document - any idea how to do that without triggering the same “event for unknown model” issue?

Thanks,

Peter

···

On Thursday, January 14, 2016 at 10:38:06 PM UTC-5, Greg Nordin wrote:

Regarding how to “remove” a line, I had a related need the other day where I needed to be able to make a line disappear and then reappear based on the state of a checkbox (see https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E). What I ended up doing is setting line.glyph.line_alpha = 0.0 when I wanted the line to disappear, and line.glyph.line_alpha = 1.0 when it should be visible.

Greg

On Thursday, January 14, 2016 at 8:26:33 PM UTC-7, [email protected] wrote:

Hi all,

I’m having a similar problem while using the bokeh client: whenever I make a change to the structure of a document, I get a javascript log message about an unknown model, and one or more error messages that read:

“Bokeh: Error handling message”

``

I’ve created a fairly small test case:

Launch the server:

bokeh serve --host localhost:5006

``

On the same machine, run the following python script:

import numpy

import bokeh.client
import bokeh.plotting
import bokeh.models.widgets

doc = bokeh.plotting.curdoc()
session = bokeh.client.push_session(doc)

checkboxes = bokeh.models.widgets.CheckboxButtonGroup(labels = [“one”])

layout = bokeh.models.widgets.VBoxForm(children = [checkboxes])
doc.add_root(layout)

class Updater(object):

def __init__(self):
    self.__plot = None
   
def __call__(self, *args, **kwargs):
    if self.__plot is not None:
        doc.remove_root(self.__plot)
    self.__plot = bokeh.plotting.Figure()
    self.__plot.line(x = range(4), y = numpy.random.randn(4))
    doc.add_root(self.__plot)

update = Updater()
checkboxes.on_click(update)

session.loop_until_closed()

``

Once both are running, I open a web browser on the same machine and go to http://localhost:5006/?bokeh-session-id=, where is the UID printed in the bokeh server log. The browser will display a single button, and when you click on it, you’ll get the following message in the browser console, where is the hex UID for the model:

"Got an event for unknown model " Object { subtype: “Figure”, type: “Plot”, id: “” }

``

You also get the error “Bokeh: Error handling message” with a stack trace (this is from firefox):

"Bokeh: Error handling message " bokeh.min.js:63:12556
Bokeh</<.jsnlog</</k</n.prototype.cerror() bokeh.min.js:63
Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.sendBatch() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.error() bokeh.min.js:63
Bokeh</<[“common/client”]</r</t.prototype._on_message() bokeh.min.js:2
Bokeh</<[“common/client”]</r</t.prototype.connect/</</t.socket.onmessage() bokeh.min.js:1

``

If you then reload the page, you will see the plot displayed correctly under the button. If you click the button again, the same thing happens: the plot doesn’t update, you get a similar log-message/stack-trace in the console, and once you reload a second time, you see the new plot.

Am I doing something wrong here, or does this seem like a bug? I am using version 0.11.0.

Are there any alternative ways to achieve a similar result? For example, I considered adding/removing lines from the Figure, and while adding lines from the on_click callback is straightforward, it’s not obvious how to remove a line. Is that possible?

Thanks,

Peter

On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc Pennington wrote:

On Mon, Jan 11, 2016 at 4:38 PM, [email protected] wrote:

I’m trying to narrow the thing down to a simple reproducible example. In the meantime, I noticed that that huge traceback in python is accompanied by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: “Rect”, id: “1c4b5b15-ab50-40a4-a9e0-06488cd3301a”}

Does that suggest anything to you?

Nothing offhand - this error message is a “should not happen” kind of thing, where somehow the two sides of the client/server connection have become desynced and don’t know about the same objects. Presumably the cause is a bug, but I don’t know what the bug is. It may be fairly easy to figure out given a way to reproduce it.

Havoc

Sorry, I’m still deep in the learning phase when it comes to Bokeh and haven’t dealt with that yet.

Greg

···

On Friday, January 15, 2016 at 9:13:32 AM UTC-7, [email protected] wrote:

That makes sense. I was starting to suspect that I would have to use the .visible property to make this work (although from your linked discussion it seems that won’t work either); setting the line_alpha is a reasonable substitute.

I’d also be fine replacing the entire Figure in the document - any idea how to do that without triggering the same “event for unknown model” issue?

Thanks,

Peter

On Thursday, January 14, 2016 at 10:38:06 PM UTC-5, Greg Nordin wrote:

Regarding how to “remove” a line, I had a related need the other day where I needed to be able to make a line disappear and then reappear based on the state of a checkbox (see https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E). What I ended up doing is setting line.glyph.line_alpha = 0.0 when I wanted the line to disappear, and line.glyph.line_alpha = 1.0 when it should be visible.

Greg

On Thursday, January 14, 2016 at 8:26:33 PM UTC-7, [email protected] wrote:

Hi all,

I’m having a similar problem while using the bokeh client: whenever I make a change to the structure of a document, I get a javascript log message about an unknown model, and one or more error messages that read:

“Bokeh: Error handling message”

``

I’ve created a fairly small test case:

Launch the server:

bokeh serve --host localhost:5006

``

On the same machine, run the following python script:

import numpy

import bokeh.client
import bokeh.plotting
import bokeh.models.widgets

doc = bokeh.plotting.curdoc()
session = bokeh.client.push_session(doc)

checkboxes = bokeh.models.widgets.CheckboxButtonGroup(labels = [“one”])

layout = bokeh.models.widgets.VBoxForm(children = [checkboxes])
doc.add_root(layout)

class Updater(object):

def __init__(self):
    self.__plot = None
   
def __call__(self, *args, **kwargs):
    if self.__plot is not None:
        doc.remove_root(self.__plot)
    self.__plot = bokeh.plotting.Figure()
    self.__plot.line(x = range(4), y = numpy.random.randn(4))
    doc.add_root(self.__plot)

update = Updater()
checkboxes.on_click(update)

session.loop_until_closed()

``

Once both are running, I open a web browser on the same machine and go to http://localhost:5006/?bokeh-session-id=, where is the UID printed in the bokeh server log. The browser will display a single button, and when you click on it, you’ll get the following message in the browser console, where is the hex UID for the model:

"Got an event for unknown model " Object { subtype: “Figure”, type: “Plot”, id: “” }

``

You also get the error “Bokeh: Error handling message” with a stack trace (this is from firefox):

"Bokeh: Error handling message " bokeh.min.js:63:12556
Bokeh</<.jsnlog</</k</n.prototype.cerror() bokeh.min.js:63
Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.sendBatch() bokeh.min.js:63
Bokeh</<.jsnlog</</w</i.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.log() bokeh.min.js:63
Bokeh</<.jsnlog</</j</t.prototype.error() bokeh.min.js:63
Bokeh</<[“common/client”]</r</t.prototype._on_message() bokeh.min.js:2
Bokeh</<[“common/client”]</r</t.prototype.connect/</</t.socket.onmessage() bokeh.min.js:1

``

If you then reload the page, you will see the plot displayed correctly under the button. If you click the button again, the same thing happens: the plot doesn’t update, you get a similar log-message/stack-trace in the console, and once you reload a second time, you see the new plot.

Am I doing something wrong here, or does this seem like a bug? I am using version 0.11.0.

Are there any alternative ways to achieve a similar result? For example, I considered adding/removing lines from the Figure, and while adding lines from the on_click callback is straightforward, it’s not obvious how to remove a line. Is that possible?

Thanks,

Peter

On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc Pennington wrote:

On Mon, Jan 11, 2016 at 4:38 PM, [email protected] wrote:

I’m trying to narrow the thing down to a simple reproducible example. In the meantime, I noticed that that huge traceback in python is accompanied by a bunch of errors in the javascript console along the lines of:

Got an event for unknown model Object {type: “Rect”, id: “1c4b5b15-ab50-40a4-a9e0-06488cd3301a”}

Does that suggest anything to you?

Nothing offhand - this error message is a “should not happen” kind of thing, where somehow the two sides of the client/server connection have become desynced and don’t know about the same objects. Presumably the cause is a bug, but I don’t know what the bug is. It may be fairly easy to figure out given a way to reproduce it.

Havoc

Hi Peter,

You could replace the entire figure, yes, it will probably result in a
lot more traffic down the wire which might be a bottleneck.

Sincerely,

Sarah Bird

···

On 1/15/16 8:13 AM, [email protected] wrote:

That makes sense. I was starting to suspect that I would have to use
the .visible property to make this work (although from your linked
discussion it seems that won't work either); setting the line_alpha is a
reasonable substitute.

I'd also be fine replacing the entire Figure in the document - any idea
how to do that without triggering the same "event for unknown model" issue?

Thanks,

Peter

On Thursday, January 14, 2016 at 10:38:06 PM UTC-5, Greg Nordin wrote:

    Regarding how to "remove" a line, I had a related need the other day
    where I needed to be able to make a line disappear and then reappear
    based on the state of a checkbox (see
    https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E
    <https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E>).
    What I ended up doing is setting `line.glyph.line_alpha = 0.0` when
    I wanted the line to disappear, and `line.glyph.line_alpha = 1.0`
    when it should be visible.

    Greg

    On Thursday, January 14, 2016 at 8:26:33 PM UTC-7, [email protected] > wrote:

        Hi all,

        I'm having a similar problem while using the bokeh client:
        whenever I make a change to the structure of a document, I get a
        javascript log message about an unknown model, and one or more
        error messages that read:

        >
        "Bokeh: Error handling message"
        >

        I've created a fairly small test case:

        Launch the server:

        >
        bokeh serve --host localhost:5006
        >

        On the same machine, run the following python script:

        >
        importnumpy

        importbokeh.client
        importbokeh.plotting
        importbokeh.models.widgets

        doc =bokeh.plotting.curdoc()
        session =bokeh.client.push_session(doc)

        checkboxes =bokeh.models.widgets.CheckboxButtonGroup(labels
        =["one"])

        layout =bokeh.models.widgets.VBoxForm(children =[checkboxes])
        doc.add_root(layout)

        classUpdater(object):
           
            def__init__(self):
                self.__plot =None
               
            def__call__(self,*args,**kwargs):
                ifself.__plot isnotNone:
                    doc.remove_root(self.__plot)
                self.__plot =bokeh.plotting.Figure()
                self.__plot.line(x =range(4),y =numpy.random.randn(4))
                doc.add_root(self.__plot)

        update =Updater()
        checkboxes.on_click(update)

        session.loop_until_closed()
        >

        Once both are running, I open a web browser on the same machine
        and go to http://localhost:5006/?bokeh-session-id=
        <http://localhost:5006/?bokeh-session-id=><session-id>, where
        <session-id> is the UID printed in the bokeh server log. The
        browser will display a single button, and when you click on it,
        you'll get the following message in the browser console, where
        <ref-id> is the hex UID for the model:

        >
        "Got an event for unknown model
        "Object{subtype:"Figure",type:"Plot",id:"<ref-id>"}
        >

        You also get the error "Bokeh: Error handling message" with a
        stack trace (this is from firefox):

        >
        "Bokeh: Error handling message "bokeh.min.js:63:12556
        Bokeh</<.jsnlog</</k</n.prototype.cerror()bokeh.min.js:63
        Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole()bokeh.min.js:63
        Bokeh</<.jsnlog</</w</i.prototype.sendBatch()bokeh.min.js:63
        Bokeh</<.jsnlog</</w</i.prototype.log()bokeh.min.js:63
        Bokeh</<.jsnlog</</j</t.prototype.log()bokeh.min.js:63
        Bokeh</<.jsnlog</</j</t.prototype.error()bokeh.min.js:63
        Bokeh</<["common/client"]</r</t.prototype._on_message()
        bokeh.min.js:2
        Bokeh</<["common/client"]</r</t.prototype.connect/</</t.socket.onmessage()bokeh.min.js:1
        >

        If you then reload the page, you will see the plot displayed
        correctly under the button. If you click the button again, the
        same thing happens: the plot doesn't update, you get a similar
        log-message/stack-trace in the console, and once you reload a
        second time, you see the new plot.

        Am I doing something wrong here, or does this seem like a bug? I
        am using version 0.11.0.

        Are there any alternative ways to achieve a similar result? For
        example, I considered adding/removing lines from the Figure, and
        while adding lines from the on_click callback is
        straightforward, it's not obvious how to remove a line. Is that
        possible?

        Thanks,

        Peter

        On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc > Pennington wrote:

            On Mon, Jan 11, 2016 at 4:38 PM, > <[email protected]> wrote:

                I'm trying to narrow the thing down to a simple
                reproducible example. In the meantime, I noticed that
                that huge traceback in python is accompanied by a bunch
                of errors in the javascript console along the lines of:

                Got an event for unknown model Object {type: "Rect",
                id: "1c4b5b15-ab50-40a4-a9e0-06488cd3301a"}

                Does that suggest anything to you?

            Nothing offhand - this error message is a "should not
            happen" kind of thing, where somehow the two sides of the
            client/server connection have become desynced and don't know
            about the same objects. Presumably the cause is a bug, but I
            don't know what the bug is. It may be fairly easy to figure
            out given a way to reproduce it.

            Havoc

--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/588bb379-085a-4f1b-8ae6-8b9831e3c439%40continuum.io
<https://groups.google.com/a/continuum.io/d/msgid/bokeh/588bb379-085a-4f1b-8ae6-8b9831e3c439%40continuum.io?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Sarah. I tried assigning a list containing the Figure object to the .children member of the containing HBox object, and that worked perfectly. I don't anticipate much traffic to this app, so the additional load shouldn't be an issue for me.

-Peter

···

On Jan 15, 2016, at 3:31 PM, Sarah Bird <[email protected]> wrote:

Hi Peter,

You could replace the entire figure, yes, it will probably result in a
lot more traffic down the wire which might be a bottleneck.

Sincerely,

Sarah Bird

On 1/15/16 8:13 AM, [email protected] wrote:
That makes sense. I was starting to suspect that I would have to use
the .visible property to make this work (although from your linked
discussion it seems that won't work either); setting the line_alpha is a
reasonable substitute.

I'd also be fine replacing the entire Figure in the document - any idea
how to do that without triggering the same "event for unknown model" issue?

Thanks,

Peter

On Thursday, January 14, 2016 at 10:38:06 PM UTC-5, Greg Nordin wrote:

   Regarding how to "remove" a line, I had a related need the other day
   where I needed to be able to make a line disappear and then reappear
   based on the state of a checkbox (see
   https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E
   <https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/2Ki1d8vTd5E>).
   What I ended up doing is setting `line.glyph.line_alpha = 0.0` when
   I wanted the line to disappear, and `line.glyph.line_alpha = 1.0`
   when it should be visible.

   Greg

   On Thursday, January 14, 2016 at 8:26:33 PM UTC-7, [email protected] >> wrote:

       Hi all,

       I'm having a similar problem while using the bokeh client:
       whenever I make a change to the structure of a document, I get a
       javascript log message about an unknown model, and one or more
       error messages that read:

       >
       "Bokeh: Error handling message"
       >

       I've created a fairly small test case:

       Launch the server:

       >
       bokeh serve --host localhost:5006
       >

       On the same machine, run the following python script:

       >
       importnumpy

       importbokeh.client
       importbokeh.plotting
       importbokeh.models.widgets

       doc =bokeh.plotting.curdoc()
       session =bokeh.client.push_session(doc)

       checkboxes =bokeh.models.widgets.CheckboxButtonGroup(labels
       =["one"])

       layout =bokeh.models.widgets.VBoxForm(children =[checkboxes])
       doc.add_root(layout)

       classUpdater(object):

           def__init__(self):
               self.__plot =None

           def__call__(self,*args,**kwargs):
               ifself.__plot isnotNone:
                   doc.remove_root(self.__plot)
               self.__plot =bokeh.plotting.Figure()
               self.__plot.line(x =range(4),y =numpy.random.randn(4))
               doc.add_root(self.__plot)

       update =Updater()
       checkboxes.on_click(update)

       session.loop_until_closed()
       >

       Once both are running, I open a web browser on the same machine
       and go to http://localhost:5006/?bokeh-session-id=
       <http://localhost:5006/?bokeh-session-id=><session-id>, where
       <session-id> is the UID printed in the bokeh server log. The
       browser will display a single button, and when you click on it,
       you'll get the following message in the browser console, where
       <ref-id> is the hex UID for the model:

       >
       "Got an event for unknown model
       "Object{subtype:"Figure",type:"Plot",id:"<ref-id>"}
       >

       You also get the error "Bokeh: Error handling message" with a
       stack trace (this is from firefox):

       >
       "Bokeh: Error handling message "bokeh.min.js:63:12556
       Bokeh</<.jsnlog</</k</n.prototype.cerror()bokeh.min.js:63
       Bokeh</<.jsnlog</</k</n.prototype.sendLogItemsConsole()bokeh.min.js:63
       Bokeh</<.jsnlog</</w</i.prototype.sendBatch()bokeh.min.js:63
       Bokeh</<.jsnlog</</w</i.prototype.log()bokeh.min.js:63
       Bokeh</<.jsnlog</</j</t.prototype.log()bokeh.min.js:63
       Bokeh</<.jsnlog</</j</t.prototype.error()bokeh.min.js:63
       Bokeh</<["common/client"]</r</t.prototype._on_message()
       bokeh.min.js:2
       Bokeh</<["common/client"]</r</t.prototype.connect/</</t.socket.onmessage()bokeh.min.js:1
       >

       If you then reload the page, you will see the plot displayed
       correctly under the button. If you click the button again, the
       same thing happens: the plot doesn't update, you get a similar
       log-message/stack-trace in the console, and once you reload a
       second time, you see the new plot.

       Am I doing something wrong here, or does this seem like a bug? I
       am using version 0.11.0.

       Are there any alternative ways to achieve a similar result? For
       example, I considered adding/removing lines from the Figure, and
       while adding lines from the on_click callback is
       straightforward, it's not obvious how to remove a line. Is that
       possible?

       Thanks,

       Peter

       On Tuesday, January 12, 2016 at 9:33:33 AM UTC-5, Havoc >> Pennington wrote:

           On Mon, Jan 11, 2016 at 4:38 PM, >> <[email protected]> wrote:

               I'm trying to narrow the thing down to a simple
               reproducible example. In the meantime, I noticed that
               that huge traceback in python is accompanied by a bunch
               of errors in the javascript console along the lines of:

               Got an event for unknown model Object {type: "Rect",
               id: "1c4b5b15-ab50-40a4-a9e0-06488cd3301a"}

               Does that suggest anything to you?

           Nothing offhand - this error message is a "should not
           happen" kind of thing, where somehow the two sides of the
           client/server connection have become desynced and don't know
           about the same objects. Presumably the cause is a bug, but I
           don't know what the bug is. It may be fairly easy to figure
           out given a way to reproduce it.

           Havoc

--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/588bb379-085a-4f1b-8ae6-8b9831e3c439%40continuum.io
<https://groups.google.com/a/continuum.io/d/msgid/bokeh/588bb379-085a-4f1b-8ae6-8b9831e3c439%40continuum.io?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/ZXeDYqvl2r8/unsubscribe.
To unsubscribe from this group and all its topics, 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/5699571A.8030708%40gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I'm a little late but this does seem like a bug to me. I think what you had
there should have worked, or at least shouldn't have failed in the
particular way that it did.

Havoc

···

On Thu, Jan 14, 2016 at 8:17 PM, <[email protected]> wrote:

Am I doing something wrong here, or does this seem like a bug? I am using
version 0.11.0.

Thanks Havoc. I’ll submit an issue.

···

On Monday, January 18, 2016 at 10:25:26 PM UTC-5, Havoc Pennington wrote:

On Thu, Jan 14, 2016 at 8:17 PM, [email protected] wrote:

Am I doing something wrong here, or does this seem like a bug? I am using version 0.11.0.

I’m a little late but this does seem like a bug to me. I think what you had there should have worked, or at least shouldn’t have failed in the particular way that it did.

Havoc