server_lifecycle.py

Hi guys,

I am trying to connect with database in “on_server_loaded” in “server_lifecycle.py” and set breakpoints in those function. unfortunately, the breakpoints can not be hitted, I just wonder where “server_lifecycle.py” should be put in and how those functions are called.

Thanks

Based on this example. https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram

server_lifecycle.py looks like that it is invoked automatically. But in my visual studio IDE, the server_lifecycle.py is never invoked.

Could someone let me know why and how? thanks a lot.

···

On Friday, July 13, 2018 at 10:29:51 AM UTC-6, [email protected] wrote:

Hi guys,

I am trying to connect with database in “on_server_loaded” in “server_lifecycle.py” and set breakpoints in those function. unfortunately, the breakpoints can not be hitted, I just wonder where “server_lifecycle.py” should be put in and how those functions are called.

Thanks

Bokeh server apps have to be run by the bokeh server, it is the bokeh server that looks for and runs "server_lifecycle.py" when you run "bokeh serve app_dir". Your IDE does not know anything about it. If you are embedding the Server programmatically, then you will have to subclass the lifecycle handler class to implement the lifecycle hook methods, then add it to your application explicitly.

Thanks,

Bryan

···

On Sep 5, 2018, at 10:26, peng wang <[email protected]> wrote:

Based on this example. https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram

server_lifecycle.py looks like that it is invoked automatically. But in my visual studio IDE, the server_lifecycle.py is never invoked.

Could someone let me know why and how? thanks a lot.

On Friday, July 13, 2018 at 10:29:51 AM UTC-6, [email protected] wrote:
Hi guys,

I am trying to connect with database in "on_server_loaded" in "server_lifecycle.py" and set breakpoints in those function. unfortunately, the breakpoints can not be hitted, I just wonder where "server_lifecycle.py" should be put in and how those functions are called.

Thanks

--
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/53291ce6-5eee-4b9c-a76f-662980d021df%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

thanks a lot, I will implement it

···

On Wednesday, September 5, 2018 at 12:01:23 PM UTC-6, Bryan Van de ven wrote:

Bokeh server apps have to be run by the bokeh server, it is the bokeh server that looks for and runs “server_lifecycle.py” when you run “bokeh serve app_dir”. Your IDE does not know anything about it. If you are embedding the Server programmatically, then you will have to subclass the lifecycle handler class to implement the lifecycle hook methods, then add it to your application explicitly.

Thanks,

Bryan

On Sep 5, 2018, at 10:26, peng wang [email protected] wrote:

Based on this example. https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram

server_lifecycle.py looks like that it is invoked automatically. But in my visual studio IDE, the server_lifecycle.py is never invoked.

Could someone let me know why and how? thanks a lot.

On Friday, July 13, 2018 at 10:29:51 AM UTC-6, [email protected] wrote:

Hi guys,

I am trying to connect with database in “on_server_loaded” in “server_lifecycle.py” and set breakpoints in those function. unfortunately, the breakpoints can not be hitted, I just wonder where “server_lifecycle.py” should be put in and how those functions are called.

Thanks


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/53291ce6-5eee-4b9c-a76f-662980d021df%40continuum.io.

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

I do not really know how to implement it, would you please give me an example? thanks

I did this:(but do not know to to connect with Bokeh server or app.)

class mHandler(Handler):

def init(self, *args, **kwargs):

return super().init(*args, **kwargs)

def on_server_loaded(self, server_context):

‘’’ If present, this function is called when the server first starts. ‘’’

print ("on_server_loaded ")

def on_server_unloaded(self, server_context):

‘’’ If present, this function is called when the server shuts down. ‘’’

print ("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")

print(“on_server_unloaded”)

def on_session_created(self, session_context):

‘’’ If present, this f"
pass

from bokeh.application.handlers import Handler

Bokeh server is:
server = Server({’/bk_plotter’: bk_plter.plot_doc}, io_loop=IOLoop(), \

``
allow_websocket_origin=[“localhost:8011”], \

websocket_max_message_size = 9999999999 * 1024 * 1024)

server.start()

server.io_loop.start()

···

On Wednesday, September 5, 2018 at 12:01:23 PM UTC-6, Bryan Van de ven wrote:

Bokeh server apps have to be run by the bokeh server, it is the bokeh server that looks for and runs “server_lifecycle.py” when you run “bokeh serve app_dir”. Your IDE does not know anything about it. If you are embedding the Server programmatically, then you will have to subclass the lifecycle handler class to implement the lifecycle hook methods, then add it to your application explicitly.

Thanks,

Bryan

On Sep 5, 2018, at 10:26, peng wang [email protected] wrote:

Based on this example. https://github.com/bokeh/bokeh/tree/master/examples/app/spectrogram

server_lifecycle.py looks like that it is invoked automatically. But in my visual studio IDE, the server_lifecycle.py is never invoked.

Could someone let me know why and how? thanks a lot.

On Friday, July 13, 2018 at 10:29:51 AM UTC-6, [email protected] wrote:

Hi guys,

I am trying to connect with database in “on_server_loaded” in “server_lifecycle.py” and set breakpoints in those function. unfortunately, the breakpoints can not be hitted, I just wonder where “server_lifecycle.py” should be put in and how those functions are called.

Thanks


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/53291ce6-5eee-4b9c-a76f-662980d021df%40continuum.io.

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