Bokeh Server as a Library and Lifecycle Hooks

Hi!

Does anyone knows how to use Lifecycle Hooks with Bokeh as a library and with 2 or more application scripts like this?

And it is possible to define this 2 functions below inside Bokeh application script so that they can be able to use all the script’s variables and then be called by the Lifecycle Hook?

on_session_created(session_context)
on_session_destroyed(session_context)

``

Thank you,

Corleo


The application calls methods on app handler like "on_session_created" if they exist. Right now, of the built in handlers, only the DirectoryHandler has these methods defined, and the ones defined on it delegate to the functions in a "server_lifecycle.py" file. But what the primary thing is that the methods are defined on on the handler. So your best bet, e.g. if you are using FunctionHander or ScriptHandler, is to subclass those handler to add the lifecycle methods you need.

For reference, the ones on DirectoryHandler are defined here:
  
  https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/directory.py#L101-L111

Thanks,

Bryan

···

On Feb 15, 2017, at 18:01, Corleo <[email protected]> wrote:

Hi!

Does anyone knows how to use Lifecycle Hooks with Bokeh as a library and with 2 or more application scripts like this?

And it is possible to define this 2 functions below inside Bokeh application script so that they can be able to use all the script's variables and then be called by the Lifecycle Hook?

on_session_created(session_context)
on_session_destroyed(session_context)

Thank you,

Corleo

--
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/b91cefca-a375-4d8e-bc12-2b723842abce%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.