Bokeh server_session & .on_click() compatibility

My button widget is not firing the .on_click() event when used with a server session. No errors are caught/displayed in browser, server or app.

Sever is run with:

bokeh serve bokeh_graph.py --port 5006 --log-level debug --allow-websocket-origin localhost:8000 --allow-websocket-origin localhost:5006

Script is generated with:

script = server_session(None, session['bokeh_id'], url="http://localhost:5006/bokeh_graph")


**When a user first logs in I am creating them a specific session with:**
bokeh_session = pull_session(url="http://localhost:5006/bokeh_graph")

bokeh_session.document.clear()
bokeh_session.document.add_root(new_layout)
session[‘bokeh_id’] = bokeh_session.id
bokeh_session.close()

Button Widget:

test_button = Button(label='Test Button')
test_button.on_click(lambda: print('TEST!'))

That said, the following do work:
1. .js_on_click() fires as expected
1. When script is generated with script = server_document(url="http://localhost:5006/bokeh_graph") the .on_click() event works
1. When I access the bokeh application directly at http://localhost:5006/bokeh_graph vs. embedded in my flask app the .on_click() event also triggers
It appears that the sever_session call is blocking the .on_click() event. Are server_sessions & these python event callbacks incompatible or am I calling the server session in an improper way which is causing the blocking?

Hi,

Offhand, this seemed possibly like:

  https://github.com/bokeh/bokeh/issues/7724

Which was addressed in:

  https://github.com/bokeh/bokeh/pull/7748

Tho it appears you are closing the session, so I am not so sure. Since I am not sure, what would really be needed to investigate is a complete, minimal reproducer that can be run out of the box.

Thanks,

Bryan

···

On Apr 18, 2018, at 09:13, [email protected] wrote:

My button widget is not firing the .on_click() event when used with a server session. No errors are caught/displayed in browser, server or app.

Sever is run with:
bokeh serve bokeh_graph.py --port 5006 --log-level debug --allow-websocket-origin localhost:8000 --allow-websocket-origin localhost:5006

Script is generated with:
script = server_session(None, session['bokeh_id'], url="http://localhost:5006/bokeh_graph")

When a user first logs in I am creating them a specific session with:
bokeh_session = pull_session(url="http://localhost:5006/bokeh_graph")
bokeh_session.document.clear()
bokeh_session.document.add_root(new_layout)
session['bokeh_id'] = bokeh_session.id
bokeh_session.close()

Button Widget:
test_button = Button(label='Test Button')
test_button.on_click(lambda: print('TEST!'))

That said, the following do work:
  • .js_on_click() fires as expected
  • When script is generated with script = server_document(url="http://localhost:5006/bokeh_graph") the .on_click() event works
  • When I access the bokeh application directly at http://localhost:5006/bokeh_graph vs. embedded in my flask app the .on_click() event also triggers
It appears that the sever_session call is blocking the .on_click() event. Are server_sessions & these python event callbacks incompatible or am I calling the server session in an improper way which is causing the blocking?

--
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/7b732e99-19eb-4498-8929-ab9e6f926cec%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hey Bryan.

I do think this issue is a bit different as I am closing the session. The crux actually appears to be something involved with clearing the document & adding a new root vs. the sever_session call.

I have attached a zip file which replicates my structure + problem.

Thanks!

sever_session_events.zip (7.9 KB)

···

On Wednesday, April 18, 2018 at 9:44:25 AM UTC-7, Bryan Van de ven wrote:

Hi,

Offhand, this seemed possibly like:

    [https://github.com/bokeh/bokeh/issues/7724](https://github.com/bokeh/bokeh/issues/7724)

Which was addressed in:

    [https://github.com/bokeh/bokeh/pull/7748](https://github.com/bokeh/bokeh/pull/7748)

Tho it appears you are closing the session, so I am not so sure. Since I am not sure, what would really be needed to investigate is a complete, minimal reproducer that can be run out of the box.

Thanks,

Bryan

On Apr 18, 2018, at 09:13, [email protected] wrote:

My button widget is not firing the .on_click() event when used with a server session. No errors are caught/displayed in browser, server or app.

Sever is run with:

bokeh serve bokeh_graph.py --port 5006 --log-level debug --allow-websocket-origin localhost:8000 --allow-websocket-origin localhost:5006

Script is generated with:

script = server_session(None, session[‘bokeh_id’], url=“http://localhost:5006/bokeh_graph”)

When a user first logs in I am creating them a specific session with:

bokeh_session = pull_session(url=“http://localhost:5006/bokeh_graph”)

bokeh_session.document.clear()

bokeh_session.document.add_root(new_layout)

session[‘bokeh_id’] = bokeh_session.id

bokeh_session.close()

Button Widget:

test_button = Button(label=‘Test Button’)

test_button.on_click(lambda: print(‘TEST!’))

That said, the following do work:

    • .js_on_click() fires as expected
    • When script is generated with script = server_document(url="[http://localhost:5006/bokeh_graph](http://localhost:5006/bokeh_graph)") the .on_click() event works
    • When I access the bokeh application directly at [http://localhost:5006/bokeh_graph](http://localhost:5006/bokeh_graph) vs. embedded in my flask app the .on_click() event also triggers

It appears that the sever_session call is blocking the .on_click() event. Are server_sessions & these python event callbacks incompatible or am I calling the server session in an improper way which is causing the blocking?


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/7b732e99-19eb-4498-8929-ab9e6f926cec%40continuum.io.

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