best way to start server and client?

First, I am fairly new to bokeh but it seems great, thank you to the dev team.

First some background.

In the online documentation you give a few ways to start the server.

A)

bokeh serve --show myapp.py

B)

  bokeh server

and then run myapp.py using

python myapp.py

I really like the B because it allows me to run myapp.py in my IDE and debug it. Not sure if this is encouraged though.

In fact, from reading through the email posts it seems that Bryan and other favor the first method.

Now the questions

  1. Is method B, i.e. just starting the server then connecting my app later, going away?

I certainly hope not.

  1. if B is going away, will there still be a way to run my app code in my favorite debugger?

pdb is ok but not nearly as functional as in Wing or PyCharm

  1. If B is not going away, can you suggest how I can strucutre my code so that myapp recognizes which way it is being used

and offers the appropriate calls. E.g. no push_session if using method A

  1. Any other advice on the different ways of connecting python code to the server.

For example, I might want a setup that allows several of my coworkers to use myapp

thank you in advance and best regards,

John Muller

I really like the B because it allows me to run myapp.py in my IDE and debug it. Not sure if this is encouraged though.
In fact, from reading through the email posts it seems that Bryan and other favor the first method.

Running "bokeh serve app.py" has some advantages, which is why I typically recommend it. When you run "bokeh serve app.py" the callbacks execute in the server, and there is only communication between the browser and the server. When you run the other way, the callback execute in your separate python script. This has a couple of implications:

* double the network traffic -- now the server has to relay everything to your separate python process
* the other process has to stay running indefinitely, otherwise there is nowhere for callbacks to run!
* if you need to "scale out" this model is unsuitable entirely. With "bokeh serve' you can just run as many as you need behind a load balancer

That said, I would not say boken.client, push_session are never useful. They just aren't my default choice, nor what I would suggest as a default choice.

Now the questions

1) Is method B, i.e. just starting the server then connecting my app later, going away?
I certainly hope not.

As I mentioned in the other reply, bokeh.client, push_session, etc. are not going away

3) If B is not going away, can you suggest how I can strucutre my code so that myapp recognizes which way it is being used
and offers the appropriate calls. E.g. no push_session if using method A

AFAIK those calls are simply turned into no-ops when a script is run in the server. I think there are some warnings emitted in the server's console log but assuming you can live with those, I think you could just use the exact same code for both cases.

4) Any other advice on the different ways of connecting python code to the server.
For example, I might want a setup that allows several of my coworkers to use myapp

This question as stated is too broad, there are too many possibilities for how things might be done based on what you might really mean specifically. Describe your preferred or ideal scenario for sharing in more detail and I'll try to comment more.

Thanks,

Bryan

ยทยทยท

On Jan 5, 2017, at 11:35 AM, [email protected] wrote: