Tornao w/Bokeh vs bokeh serve

I’m finding the ‘serve directory’ setup a bit limiting, broken imports etc.
Is there any major disadvantage to running the Bokeh server within a Tornado app vs just bokeh serve?

Hi,

Following the existing examples, currently num_procs is limited to one until this is resolved:

  Server(..., io_loop=io_loop, num_procs=0) --> RuntimeError · Issue #6439 · bokeh/bokeh · GitHub

There's probably some workaround to that butI have not had an opportunity to look further yet.

As an alternative, you might also consider defining your own application Handler to suit your needs:

  https://github.com/bokeh/bokeh/tree/master/bokeh/application/handlers

An Application is just a collection of Handlers (usually one) that have a modify_doc method for creating the new doc for each new session. You can write your own Handler class with your own modify doc that handles directories or scripts differently. I am currently working on updating the docs for Application, but they won't be available on the dev docs site until next week, the above is the gist. Right now there's also not a way to "install" new handlers (maybe this is a motivating use case) but you could start the server the same way the "serve" command does:

  https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py

except build applications to run differently using your custom handlers here:

  https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py#L475

In fact, this would be the workaround to the issue above that I mentioned. And If you don't need or want to write a new handler, there's no reason you couldn't just just the existing FunctionHandler, e.g.

Thanks,

Bryan

···

On Jul 21, 2017, at 07:37, Andrew Gardner <[email protected]> wrote:

I'm finding the 'serve directory' setup a bit limiting, broken imports etc.
Is there any major disadvantage to running the Bokeh server within a Tornado app vs just bokeh serve?

--
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/3ed06b26-1acf-45c1-a058-6905a5485bde%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Cheers Bryan, looks good!

···

On Friday, July 21, 2017 at 2:41:47 PM UTC+1, Bryan Van de ven wrote:

Hi,

Following the existing examples, currently num_procs is limited to one until this is resolved:

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

There’s probably some workaround to that butI have not had an opportunity to look further yet.

As an alternative, you might also consider defining your own application Handler to suit your needs:

    [https://github.com/bokeh/bokeh/tree/master/bokeh/application/handlers](https://github.com/bokeh/bokeh/tree/master/bokeh/application/handlers)

An Application is just a collection of Handlers (usually one) that have a modify_doc method for creating the new doc for each new session. You can write your own Handler class with your own modify doc that handles directories or scripts differently. I am currently working on updating the docs for Application, but they won’t be available on the dev docs site until next week, the above is the gist. Right now there’s also not a way to “install” new handlers (maybe this is a motivating use case) but you could start the server the same way the “serve” command does:

    [https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py](https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py)

except build applications to run differently using your custom handlers here:

    [https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py#L475](https://github.com/bokeh/bokeh/blob/master/bokeh/command/subcommands/serve.py#L475)

In fact, this would be the workaround to the issue above that I mentioned. And If you don’t need or want to write a new handler, there’s no reason you couldn’t just just the existing FunctionHandler, e.g.

Thanks,

Bryan

On Jul 21, 2017, at 07:37, Andrew Gardner [email protected] wrote:

I’m finding the ‘serve directory’ setup a bit limiting, broken imports etc.

Is there any major disadvantage to running the Bokeh server within a Tornado app vs just bokeh serve?


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/3ed06b26-1acf-45c1-a058-6905a5485bde%40continuum.io.

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