New dev version?

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn’t notice these weren’t in Bryan’s code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

···

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:

Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method – you just run “bokeh serve” or “bokeh html” or “bokeh json” on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

On Dec 23, 2015, at 10:20 PM, Havoc Pennington [email protected] wrote:

Don’t know if this is your issue, but the same script can’t be used in both ways.

If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it’s intended to be run outside the server and push a document to the server from outside.

If the script only modifies curdoc() with no explicit output/push/show then it’s intended to be run inside the server by passing it to bokeh serve.

push_session and pull_session should be added to this list to give an error in this case:

https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15

Havoc

On Dec 23, 2015, at 6:27 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

I found my problem for #2: I inadvertentlyh ad “bokeh serve” running in another terminal window. Also, I was mistakenly stopping “bokeh serve” with ^Z which does not properly shut it down, whereas ^C does do a full shut down.

Ok, this leads to two more things:

  1. If I do “bokeh serve line_animate_widget.py --port=5010 --show”, the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do “bokeh serve line_animate_widget.py --show” except it takes 5-10 seconds for the browser window to show up. If I do “bokeh serve line_animate_widget.py” and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.
  1. On the other hand, if I do “bokeh serve” in one terminal window and “python line_animate_widget.py” in another, the plot shows up immediately with working buttons and an animated line.

Greg

On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:

Greg,

You get the error about the port because you left the first “bokeh serve” running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:

    bokeh serve line_animate_widget.py --port=5010 --show

I’m not sure about the other behaviour with “html” or “json” that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.

Bryan


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/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io.

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


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/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io.

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

Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current "dev" deploy of the docs:

  http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server "makes good sense" in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling "bokeh serve" with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using "bokeh serve foo.py" and using "bokeh serve" + "python foo.py" is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

···

On Dec 24, 2015, at 2:07 AM, Greg Nordin <[email protected]> wrote:

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn't notice these weren't in Bryan's code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method -- you just run "bokeh serve" or "bokeh html" or "bokeh json" on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

> On Dec 23, 2015, at 10:20 PM, Havoc Pennington <[email protected]> wrote:
>
> Don't know if this is your issue, but the same script can't be used in both ways.
> If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it's intended to be run outside the server and push a document to the server from outside.
>
> If the script only modifies curdoc() with no explicit output/push/show then it's intended to be run inside the server by passing it to bokeh serve.
>
> push_session and pull_session should be added to this list to give an error in this case:
> https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15
>
> Havoc
>
> On Dec 23, 2015, at 6:27 PM, Greg Nordin <[email protected]> wrote:
>
>> Hi Bryan,
>>
>> I found my problem for #2: I inadvertentlyh ad "bokeh serve" running in another terminal window. Also, I was mistakenly stopping "bokeh serve" with ^Z which does not properly shut it down, whereas ^C does do a full shut down.
>>
>> Ok, this leads to two more things:
>>
>> 1. If I do "bokeh serve line_animate_widget.py --port=5010 --show", the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do "bokeh serve line_animate_widget.py --show" except it takes 5-10 seconds for the browser window to show up. If I do "bokeh serve line_animate_widget.py" and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.
>>
>> 2. On the other hand, if I do "bokeh serve" in one terminal window and "python line_animate_widget.py" in another, the plot shows up immediately with working buttons and an animated line.
>>
>> Greg
>>
>> On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
>> Greg,
>>
>> You get the error about the port because you left the first "bokeh serve" running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:
>>
>> bokeh serve line_animate_widget.py --port=5010 --show
>>
>> I'm not sure about the other behaviour with "html" or "json" that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.
>>
>> Bryan
>>
>>
>> > >
>> > > --
>> > > 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 bokeh+un...@continuum.io.
>> > > To post to this group, send email to bo...@continuum.io.
>> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com\.
>> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>> >
>> >
>> > --
>> > 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 bokeh+un...@continuum.io.
>> > To post to this group, send email to bo...@continuum.io.
>> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io\.
>> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>
>>
>> --
>> 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 bokeh+un...@continuum.io.
>> To post to this group, send email to bo...@continuum.io.
>> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Thanks for the link–I hadn’t noticed that section in the documentation before.

Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn’t know what those commands did, or how they interacted with “bokeh serve”, it didn’t occur to me to question their presence. As part of the example file I thought that’s just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they’re not :slight_smile: ).

Also, I’m interested in doing animations from a notebook as well as standalone. I haven’t started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don’t really understand the scope of “bokeh serve” and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I’m hoping to avoid this because I’m not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn’t make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I’m thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Thanks again for all of your help and patience–it’s been great getting such timely and useful feedback!

Greg

···

On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:

Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current “dev” deploy of the docs:

    [http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html](http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html)

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server “makes good sense” in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling “bokeh serve” with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using “bokeh serve foo.py” and using “bokeh serve” + “python foo.py” is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

On Dec 24, 2015, at 2:07 AM, Greg Nordin [email protected] wrote:

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn’t notice these weren’t in Bryan’s code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:

Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method – you just run “bokeh serve” or “bokeh html” or “bokeh json” on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

On Dec 23, 2015, at 10:20 PM, Havoc Pennington [email protected] wrote:

Don’t know if this is your issue, but the same script can’t be used in both ways.
If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it’s intended to be run outside the server and push a document to the server from outside.

If the script only modifies curdoc() with no explicit output/push/show then it’s intended to be run inside the server by passing it to bokeh serve.

push_session and pull_session should be added to this list to give an error in this case:
https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15

Havoc

On Dec 23, 2015, at 6:27 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

I found my problem for #2: I inadvertentlyh ad “bokeh serve” running in another terminal window. Also, I was mistakenly stopping “bokeh serve” with ^Z which does not properly shut it down, whereas ^C does do a full shut down.

Ok, this leads to two more things:

  1. If I do “bokeh serve line_animate_widget.py --port=5010 --show”, the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do “bokeh serve line_animate_widget.py --show” except it takes 5-10 seconds for the browser window to show up. If I do “bokeh serve line_animate_widget.py” and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.

  2. On the other hand, if I do “bokeh serve” in one terminal window and “python line_animate_widget.py” in another, the plot shows up immediately with working buttons and an animated line.

Greg

On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
Greg,

You get the error about the port because you left the first “bokeh serve” running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:

    bokeh serve line_animate_widget.py --port=5010 --show

I’m not sure about the other behaviour with “html” or “json” that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.

Bryan


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/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io.

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

Hi Bryan,

Thanks for the link--I hadn't noticed that section in the documentation before.

Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn't know what those commands did, or how they interacted with "bokeh serve", it didn't occur to me to question their presence. As part of the example file I thought that's just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they're not :slight_smile: ).

Agreed about comments. The examples in plotting/server *are* intended to be run as "bokeh serve" + "python foo.py" and the examples in app/ are intended to be run as "bokeh server foo.py" but we need to emphasize this in more places.

Also, I'm interested in doing animations from a notebook as well as standalone. I haven't started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don't really understand the scope of "bokeh serve" and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

If your interest lies in developing things *only* for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.

The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I'm hoping to avoid this because I'm not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn't make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I'm thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for "single user" or "local" use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type "ipython notebook" and that is no big deal at all! For "local" apps the bokeh server is just like that. What I would suggest for you is that you make a "demo.py" and then every student can simply run "bokeh serve demo.py" or if you want to work in notebooks, they can run "bokeh serve" and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.

Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time -- bokeh is not magic :slight_smile: -- and that might be expensive, etc.

···

On Dec 24, 2015, at 10:23 AM, Greg Nordin <[email protected]> wrote:

Thanks again for all of your help and patience--it's been great getting such timely and useful feedback!

Greg

On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:
Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current "dev" deploy of the docs:

        http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server "makes good sense" in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling "bokeh serve" with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using "bokeh serve foo.py" and using "bokeh serve" + "python foo.py" is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

> On Dec 24, 2015, at 2:07 AM, Greg Nordin <[email protected]> wrote:
>
> Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn't notice these weren't in Bryan's code). Thanks Havoc & Bryan!
>
> Is there documentation somewhere about bokeh serve and how to work with it?
>
> Greg
>
> On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
> Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method -- you just run "bokeh serve" or "bokeh html" or "bokeh json" on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.
>
> Bryan
>
>
> > On Dec 23, 2015, at 10:20 PM, Havoc Pennington <[email protected]> wrote:
> >
> > Don't know if this is your issue, but the same script can't be used in both ways.
> > If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it's intended to be run outside the server and push a document to the server from outside.
> >
> > If the script only modifies curdoc() with no explicit output/push/show then it's intended to be run inside the server by passing it to bokeh serve.
> >
> > push_session and pull_session should be added to this list to give an error in this case:
> > https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15
> >
> > Havoc
> >
> > On Dec 23, 2015, at 6:27 PM, Greg Nordin <[email protected]> wrote:
> >
> >> Hi Bryan,
> >>
> >> I found my problem for #2: I inadvertentlyh ad "bokeh serve" running in another terminal window. Also, I was mistakenly stopping "bokeh serve" with ^Z which does not properly shut it down, whereas ^C does do a full shut down.
> >>
> >> Ok, this leads to two more things:
> >>
> >> 1. If I do "bokeh serve line_animate_widget.py --port=5010 --show", the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do "bokeh serve line_animate_widget.py --show" except it takes 5-10 seconds for the browser window to show up. If I do "bokeh serve line_animate_widget.py" and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.
> >>
> >> 2. On the other hand, if I do "bokeh serve" in one terminal window and "python line_animate_widget.py" in another, the plot shows up immediately with working buttons and an animated line.
> >>
> >> Greg
> >>
> >> On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
> >> Greg,
> >>
> >> You get the error about the port because you left the first "bokeh serve" running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:
> >>
> >> bokeh serve line_animate_widget.py --port=5010 --show
> >>
> >> I'm not sure about the other behaviour with "html" or "json" that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.
> >>
> >> Bryan
> >>
> >>
> >> > >
> >> > > --
> >> > > 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 bokeh+un...@continuum.io.
> >> > > To post to this group, send email to bo...@continuum.io.
> >> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com\.
> >> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >> >
> >> >
> >> > --
> >> > 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 bokeh+un...@continuum.io.
> >> > To post to this group, send email to bo...@continuum.io.
> >> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io\.
> >> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>
> >>
> >> --
> >> 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 bokeh+un...@continuum.io.
> >> To post to this group, send email to bo...@continuum.io.
> >> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io\.
> >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> > --
> > 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 bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Thanks for your comments and suggestions–this helps a lot to clarify the use cases. It looks like I may go with the stand alone server approach for students to run on their own computers, and have supplemental information in notebooks. Alternatively, if the notebook comms turns out well I could go with that. In any case, thanks again for all of your help.

Greg

···

On Thursday, December 24, 2015 at 9:58:07 AM UTC-7, Bryan Van de ven wrote:

On Dec 24, 2015, at 10:23 AM, Greg Nordin [email protected] wrote:

Hi Bryan,

Thanks for the link–I hadn’t noticed that section in the documentation before.

Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn’t know what those commands did, or how they interacted with “bokeh serve”, it didn’t occur to me to question their presence. As part of the example file I thought that’s just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they’re not :slight_smile: ).

Agreed about comments. The examples in plotting/server are intended to be run as “bokeh serve” + “python foo.py” and the examples in app/ are intended to be run as “bokeh server foo.py” but we need to emphasize this in more places.

Also, I’m interested in doing animations from a notebook as well as standalone. I haven’t started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don’t really understand the scope of “bokeh serve” and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

If your interest lies in developing things only for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.

The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I’m hoping to avoid this because I’m not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn’t make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I’m thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for “single user” or “local” use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type “ipython notebook” and that is no big deal at all! For “local” apps the bokeh server is just like that. What I would suggest for you is that you make a “demo.py” and then every student can simply run “bokeh serve demo.py” or if you want to work in notebooks, they can run “bokeh serve” and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.

Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time – bokeh is not magic :slight_smile: – and that might be expensive, etc.

Thanks again for all of your help and patience–it’s been great getting such timely and useful feedback!

Greg

On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:

Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current “dev” deploy of the docs:

    [http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html](http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html)

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server “makes good sense” in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling “bokeh serve” with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using “bokeh serve foo.py” and using “bokeh serve” + “python foo.py” is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

On Dec 24, 2015, at 2:07 AM, Greg Nordin [email protected] wrote:

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn’t notice these weren’t in Bryan’s code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method – you just run “bokeh serve” or “bokeh html” or “bokeh json” on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

On Dec 23, 2015, at 10:20 PM, Havoc Pennington [email protected] wrote:

Don’t know if this is your issue, but the same script can’t be used in both ways.
If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it’s intended to be run outside the server and push a document to the server from outside.

If the script only modifies curdoc() with no explicit output/push/show then it’s intended to be run inside the server by passing it to bokeh serve.

push_session and pull_session should be added to this list to give an error in this case:
https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15

Havoc

On Dec 23, 2015, at 6:27 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

I found my problem for #2: I inadvertentlyh ad “bokeh serve” running in another terminal window. Also, I was mistakenly stopping “bokeh serve” with ^Z which does not properly shut it down, whereas ^C does do a full shut down.

Ok, this leads to two more things:

  1. If I do “bokeh serve line_animate_widget.py --port=5010 --show”, the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do “bokeh serve line_animate_widget.py --show” except it takes 5-10 seconds for the browser window to show up. If I do “bokeh serve line_animate_widget.py” and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.

  2. On the other hand, if I do “bokeh serve” in one terminal window and “python line_animate_widget.py” in another, the plot shows up immediately with working buttons and an animated line.

Greg

On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
Greg,

You get the error about the port because you left the first “bokeh serve” running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:

    bokeh serve line_animate_widget.py --port=5010 --show

I’m not sure about the other behaviour with “html” or “json” that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.

Bryan


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/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io.

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

Hi Greg,

Both the "local" or "standalalone" (indivodual?) server approach and the notebook comms approach should be a breeze. Making a centrally deployed version should not be so bad either, but I understand the timing of the release might make that a tight schedule. I would be interested in learning more about the app though, to help have some example use-cases: what amounts of data, what sort of update rates and interactions, etc?

BTW I uncovered what I think is the last remaining annoying instability that was causing (very many) spurious events getting sent back to the server. There will be a new dev build with it, probably on the 26th.

Thanks,

Bryan

···

On Dec 24, 2015, at 3:00 PM, Greg Nordin <[email protected]> wrote:

Hi Bryan,

Thanks for your comments and suggestions--this helps a lot to clarify the use cases. It looks like I may go with the stand alone server approach for students to run on their own computers, and have supplemental information in notebooks. Alternatively, if the notebook comms turns out well I could go with that. In any case, thanks again for all of your help.

Greg

On Thursday, December 24, 2015 at 9:58:07 AM UTC-7, Bryan Van de ven wrote:

> On Dec 24, 2015, at 10:23 AM, Greg Nordin <[email protected]> wrote:
>
> Hi Bryan,
>
> Thanks for the link--I hadn't noticed that section in the documentation before.
>
> Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn't know what those commands did, or how they interacted with "bokeh serve", it didn't occur to me to question their presence. As part of the example file I thought that's just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they're not :slight_smile: ).

Agreed about comments. The examples in plotting/server *are* intended to be run as "bokeh serve" + "python foo.py" and the examples in app/ are intended to be run as "bokeh server foo.py" but we need to emphasize this in more places.

> Also, I'm interested in doing animations from a notebook as well as standalone. I haven't started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don't really understand the scope of "bokeh serve" and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

If your interest lies in developing things *only* for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.

> The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I'm hoping to avoid this because I'm not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn't make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I'm thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for "single user" or "local" use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type "ipython notebook" and that is no big deal at all! For "local" apps the bokeh server is just like that. What I would suggest for you is that you make a "demo.py" and then every student can simply run "bokeh serve demo.py" or if you want to work in notebooks, they can run "bokeh serve" and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.

Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time -- bokeh is not magic :slight_smile: -- and that might be expensive, etc.

> Thanks again for all of your help and patience--it's been great getting such timely and useful feedback!
>
> Greg
>
> On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:
> Hi Greg,
>
> Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.
>
> Regarding docs, there is a little bit at the current "dev" deploy of the docs:
>
> http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html
>
> However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server "makes good sense" in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)
>
> As Havoc mentions, calling "bokeh serve" with a push_session, pull_session, etc is detectable, so we will add a loud warning.
>
> BTW the distinction between using "bokeh serve foo.py" and using "bokeh serve" + "python foo.py" is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).
>
> Bryan
>
>
> > On Dec 24, 2015, at 2:07 AM, Greg Nordin <[email protected]> wrote:
> >
> > Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn't notice these weren't in Bryan's code). Thanks Havoc & Bryan!
> >
> > Is there documentation somewhere about bokeh serve and how to work with it?
> >
> > Greg
> >
> > On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
> > Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method -- you just run "bokeh serve" or "bokeh html" or "bokeh json" on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.
> >
> > Bryan
> >
> >
> > > On Dec 23, 2015, at 10:20 PM, Havoc Pennington <[email protected]> wrote:
> > >
> > > Don't know if this is your issue, but the same script can't be used in both ways.
> > > If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it's intended to be run outside the server and push a document to the server from outside.
> > >
> > > If the script only modifies curdoc() with no explicit output/push/show then it's intended to be run inside the server by passing it to bokeh serve.
> > >
> > > push_session and pull_session should be added to this list to give an error in this case:
> > > https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15
> > >
> > > Havoc
> > >
> > > On Dec 23, 2015, at 6:27 PM, Greg Nordin <[email protected]> wrote:
> > >
> > >> Hi Bryan,
> > >>
> > >> I found my problem for #2: I inadvertentlyh ad "bokeh serve" running in another terminal window. Also, I was mistakenly stopping "bokeh serve" with ^Z which does not properly shut it down, whereas ^C does do a full shut down.
> > >>
> > >> Ok, this leads to two more things:
> > >>
> > >> 1. If I do "bokeh serve line_animate_widget.py --port=5010 --show", the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do "bokeh serve line_animate_widget.py --show" except it takes 5-10 seconds for the browser window to show up. If I do "bokeh serve line_animate_widget.py" and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.
> > >>
> > >> 2. On the other hand, if I do "bokeh serve" in one terminal window and "python line_animate_widget.py" in another, the plot shows up immediately with working buttons and an animated line.
> > >>
> > >> Greg
> > >>
> > >> On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
> > >> Greg,
> > >>
> > >> You get the error about the port because you left the first "bokeh serve" running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:
> > >>
> > >> bokeh serve line_animate_widget.py --port=5010 --show
> > >>
> > >> I'm not sure about the other behaviour with "html" or "json" that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.
> > >>
> > >> Bryan
> > >>
> > >>
> > >> > >
> > >> > > --
> > >> > > 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 bokeh+un...@continuum.io.
> > >> > > To post to this group, send email to bo...@continuum.io.
> > >> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com\.
> > >> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >> >
> > >> >
> > >> > --
> > >> > 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 bokeh+un...@continuum.io.
> > >> > To post to this group, send email to bo...@continuum.io.
> > >> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io\.
> > >> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>
> > >>
> > >> --
> > >> 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 bokeh+un...@continuum.io.
> > >> To post to this group, send email to bo...@continuum.io.
> > >> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io\.
> > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> > > --
> > > 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 bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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 bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/16d5a1be-3984-4c73-9701-fdb56944d8a8%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

That’s great about finding the instability issue. I’ll look forward to the next dev build. Also, I’ll get you some info as I work on the first app over the next week or so and the details about data, update rates, and interactions become clear. In the meantime I’ve run into an issue about how to update text on a plot during an animation. I have not been able to figure out how to do it, despite looking through documentation, examples, stack overflow, etc. Here is example code that illustrates what I mean:

···

from bokeh.plotting import figure, curdoc

from bokeh.models import ColumnDataSource

from bokeh.driving import linear

import numpy as np

Define a simple arbitrary pulse function. Let’s use 1/2 cycle of a cosine centered at 0,

and zero everywhere else.

def pulse(a):

if a < np.pi/2.0 and a > -np.pi/2.0:

return np.cos(a)

else:

return 0.0

Create a vectorized version of the pulse function so we can pass arrays as arguments

and automatically get an array back

vpulse = np.vectorize(pulse)

u = 1.0

t = 0.0

delta_t = 0.25

zmin = -30

zmax = 30

numpnts = 500

periodic_callback_time_ms = 50

x = np.linspace(zmin,zmax,numpnts)

y1 = vpulse(x - u*t)

p = figure(plot_width=600, plot_height=400, x_range=(zmin,zmax), y_range=(0,1.1), title=“Forward Propagating Pulse”)

l1 = p.line(x, y1, line_width=2, color=‘red’)

p.xaxis.axis_label = “Distance (m)”

p.yaxis.axis_label = “Pulse Amplitude (arb.)”

t1 = p.text(zmin+1.5, 1.0, text=[‘u = 1.0 m/s’], text_align=“left”, text_font_size=“10pt”)

t2 = p.text(zmin+1.5, 1.0-0.08, text=[‘t = {} s’.format(t)], text_align=“left”, text_font_size=“10pt”)

@linear(m=delta_t)

def update(new_t):

if playing:

l1.data_source.data[“y”] = vpulse(x - u*new_t)

Need something here to change the text in t2 that is displayed on the plot to be “t = {} s”.format(new_t). I don’t know how to access t2 to change its text.

playing = True

curdoc().add_periodic_callback(update, periodic_callback_time_ms)


What I don’t understand is how to change the text in t2 every time update() is called. If there is some documentation you could point me to, that would be great.

Thanks,

Greg

On Thursday, December 24, 2015 at 5:33:09 PM UTC-7, Bryan Van de ven wrote:

Hi Greg,

Both the “local” or “standalalone” (indivodual?) server approach and the notebook comms approach should be a breeze. Making a centrally deployed version should not be so bad either, but I understand the timing of the release might make that a tight schedule. I would be interested in learning more about the app though, to help have some example use-cases: what amounts of data, what sort of update rates and interactions, etc?

BTW I uncovered what I think is the last remaining annoying instability that was causing (very many) spurious events getting sent back to the server. There will be a new dev build with it, probably on the 26th.

Thanks,

Bryan

On Dec 24, 2015, at 3:00 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

Thanks for your comments and suggestions–this helps a lot to clarify the use cases. It looks like I may go with the stand alone server approach for students to run on their own computers, and have supplemental information in notebooks. Alternatively, if the notebook comms turns out well I could go with that. In any case, thanks again for all of your help.

Greg

On Thursday, December 24, 2015 at 9:58:07 AM UTC-7, Bryan Van de ven wrote:

On Dec 24, 2015, at 10:23 AM, Greg Nordin [email protected] wrote:

Hi Bryan,

Thanks for the link–I hadn’t noticed that section in the documentation before.

Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn’t know what those commands did, or how they interacted with “bokeh serve”, it didn’t occur to me to question their presence. As part of the example file I thought that’s just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they’re not :slight_smile: ).

Agreed about comments. The examples in plotting/server are intended to be run as “bokeh serve” + “python foo.py” and the examples in app/ are intended to be run as “bokeh server foo.py” but we need to emphasize this in more places.

Also, I’m interested in doing animations from a notebook as well as standalone. I haven’t started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don’t really understand the scope of “bokeh serve” and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

If your interest lies in developing things only for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.

The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I’m hoping to avoid this because I’m not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn’t make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I’m thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for “single user” or “local” use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type “ipython notebook” and that is no big deal at all! For “local” apps the bokeh server is just like that. What I would suggest for you is that you make a “demo.py” and then every student can simply run “bokeh serve demo.py” or if you want to work in notebooks, they can run “bokeh serve” and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.

Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time – bokeh is not magic :slight_smile: – and that might be expensive, etc.

Thanks again for all of your help and patience–it’s been great getting such timely and useful feedback!

Greg

On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:
Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current “dev” deploy of the docs:

    [http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html](http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html)

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server “makes good sense” in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling “bokeh serve” with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using “bokeh serve foo.py” and using “bokeh serve” + “python foo.py” is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

On Dec 24, 2015, at 2:07 AM, Greg Nordin [email protected] wrote:

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn’t notice these weren’t in Bryan’s code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method – you just run “bokeh serve” or “bokeh html” or “bokeh json” on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

On Dec 23, 2015, at 10:20 PM, Havoc Pennington [email protected] wrote:

Don’t know if this is your issue, but the same script can’t be used in both ways.
If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it’s intended to be run outside the server and push a document to the server from outside.

If the script only modifies curdoc() with no explicit output/push/show then it’s intended to be run inside the server by passing it to bokeh serve.

push_session and pull_session should be added to this list to give an error in this case:
https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15

Havoc

On Dec 23, 2015, at 6:27 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

I found my problem for #2: I inadvertentlyh ad “bokeh serve” running in another terminal window. Also, I was mistakenly stopping “bokeh serve” with ^Z which does not properly shut it down, whereas ^C does do a full shut down.

Ok, this leads to two more things:

  1. If I do “bokeh serve line_animate_widget.py --port=5010 --show”, the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do “bokeh serve line_animate_widget.py --show” except it takes 5-10 seconds for the browser window to show up. If I do “bokeh serve line_animate_widget.py” and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.

  2. On the other hand, if I do “bokeh serve” in one terminal window and “python line_animate_widget.py” in another, the plot shows up immediately with working buttons and an animated line.

Greg

On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
Greg,

You get the error about the port because you left the first “bokeh serve” running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:

    bokeh serve line_animate_widget.py --port=5010 --show

I’m not sure about the other behaviour with “html” or “json” that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.

Bryan


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/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/16d5a1be-3984-4c73-9701-fdb56944d8a8%40continuum.io.

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

Hi Greg,

Updating the text for a Text glyph is like updating any other glyph, you need to update the data source for the glyph. Here is an example that updates text from a timeout callback:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/server/timeout.py

Let me know if that's not enough to get started and I will try to work up a full example.

Also the good news about the app is if you write it for "bokeh serve" app style the students can run it locally and you could also potentially deploy it as a site with no changes.

Thanks,

Bryan

···

On Dec 24, 2015, at 6:54 PM, Greg Nordin <[email protected]> wrote:

Hi Bryan,

That's great about finding the instability issue. I'll look forward to the next dev build. Also, I'll get you some info as I work on the first app over the next week or so and the details about data, update rates, and interactions become clear. In the meantime I've run into an issue about how to update text on a plot during an animation. I have not been able to figure out how to do it, despite looking through documentation, examples, stack overflow, etc. Here is example code that illustrates what I mean:

----------------
from bokeh.plotting import figure, curdoc
from bokeh.models import ColumnDataSource
from bokeh.driving import linear
import numpy as np

# Define a simple arbitrary pulse function. Let's use 1/2 cycle of a cosine centered at 0,
# and zero everywhere else.

def pulse(a):
    if a < np.pi/2.0 and a > -np.pi/2.0:
        return np.cos(a)
    else:
        return 0.0

# Create a vectorized version of the pulse function so we can pass arrays as arguments
# and automatically get an array back

vpulse = np.vectorize(pulse)

u = 1.0
t = 0.0
delta_t = 0.25
zmin = -30
zmax = 30
numpnts = 500
periodic_callback_time_ms = 50
x = np.linspace(zmin,zmax,numpnts)
y1 = vpulse(x - u*t)

p = figure(plot_width=600, plot_height=400, x_range=(zmin,zmax), y_range=(0,1.1), title="Forward Propagating Pulse")
l1 = p.line(x, y1, line_width=2, color='red')
p.xaxis.axis_label = "Distance (m)"
p.yaxis.axis_label = "Pulse Amplitude (arb.)"
t1 = p.text(zmin+1.5, 1.0, text=['u = 1.0 m/s'], text_align="left", text_font_size="10pt")
t2 = p.text(zmin+1.5, 1.0-0.08, text=['t = {} s'.format(t)], text_align="left", text_font_size="10pt")

@linear(m=delta_t)
def update(new_t):
    if playing:
        l1.data_source.data["y"] = vpulse(x - u*new_t)
        # Need something here to change the text in t2 that is displayed on the plot to be "t = {} s".format(new_t). I don't know how to access t2 to change its text.

playing = True
curdoc().add_periodic_callback(update, periodic_callback_time_ms)
----------------

What I don't understand is how to change the text in t2 every time update() is called. If there is some documentation you could point me to, that would be great.

Thanks,
Greg

On Thursday, December 24, 2015 at 5:33:09 PM UTC-7, Bryan Van de ven wrote:
Hi Greg,

Both the "local" or "standalalone" (indivodual?) server approach and the notebook comms approach should be a breeze. Making a centrally deployed version should not be so bad either, but I understand the timing of the release might make that a tight schedule. I would be interested in learning more about the app though, to help have some example use-cases: what amounts of data, what sort of update rates and interactions, etc?

BTW I uncovered what I think is the last remaining annoying instability that was causing (very many) spurious events getting sent back to the server. There will be a new dev build with it, probably on the 26th.

Thanks,

Bryan

> On Dec 24, 2015, at 3:00 PM, Greg Nordin <[email protected]> wrote:
>
> Hi Bryan,
>
> Thanks for your comments and suggestions--this helps a lot to clarify the use cases. It looks like I may go with the stand alone server approach for students to run on their own computers, and have supplemental information in notebooks. Alternatively, if the notebook comms turns out well I could go with that. In any case, thanks again for all of your help.
>
> Greg
>
> On Thursday, December 24, 2015 at 9:58:07 AM UTC-7, Bryan Van de ven wrote:
>
> > On Dec 24, 2015, at 10:23 AM, Greg Nordin <[email protected]> wrote:
> >
> > Hi Bryan,
> >
> > Thanks for the link--I hadn't noticed that section in the documentation before.
> >
> > Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn't know what those commands did, or how they interacted with "bokeh serve", it didn't occur to me to question their presence. As part of the example file I thought that's just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they're not :slight_smile: ).
>
> Agreed about comments. The examples in plotting/server *are* intended to be run as "bokeh serve" + "python foo.py" and the examples in app/ are intended to be run as "bokeh server foo.py" but we need to emphasize this in more places.
>
> > Also, I'm interested in doing animations from a notebook as well as standalone. I haven't started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don't really understand the scope of "bokeh serve" and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.
>
> If your interest lies in developing things *only* for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.
>
> > The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I'm hoping to avoid this because I'm not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn't make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I'm thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.
>
> Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for "single user" or "local" use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type "ipython notebook" and that is no big deal at all! For "local" apps the bokeh server is just like that. What I would suggest for you is that you make a "demo.py" and then every student can simply run "bokeh serve demo.py" or if you want to work in notebooks, they can run "bokeh serve" and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.
>
> Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time -- bokeh is not magic :slight_smile: -- and that might be expensive, etc.
>
> > Thanks again for all of your help and patience--it's been great getting such timely and useful feedback!
> >
> > Greg
> >
> > On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:
> > Hi Greg,
> >
> > Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.
> >
> > Regarding docs, there is a little bit at the current "dev" deploy of the docs:
> >
> > http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html
> >
> > However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server "makes good sense" in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)
> >
> > As Havoc mentions, calling "bokeh serve" with a push_session, pull_session, etc is detectable, so we will add a loud warning.
> >
> > BTW the distinction between using "bokeh serve foo.py" and using "bokeh serve" + "python foo.py" is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).
> >
> > Bryan
> >
> >
> > > On Dec 24, 2015, at 2:07 AM, Greg Nordin <[email protected]> wrote:
> > >
> > > Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn't notice these weren't in Bryan's code). Thanks Havoc & Bryan!
> > >
> > > Is there documentation somewhere about bokeh serve and how to work with it?
> > >
> > > Greg
> > >
> > > On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
> > > Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method -- you just run "bokeh serve" or "bokeh html" or "bokeh json" on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.
> > >
> > > Bryan
> > >
> > >
> > > > On Dec 23, 2015, at 10:20 PM, Havoc Pennington <[email protected]> wrote:
> > > >
> > > > Don't know if this is your issue, but the same script can't be used in both ways.
> > > > If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it's intended to be run outside the server and push a document to the server from outside.
> > > >
> > > > If the script only modifies curdoc() with no explicit output/push/show then it's intended to be run inside the server by passing it to bokeh serve.
> > > >
> > > > push_session and pull_session should be added to this list to give an error in this case:
> > > > https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15
> > > >
> > > > Havoc
> > > >
> > > > On Dec 23, 2015, at 6:27 PM, Greg Nordin <[email protected]> wrote:
> > > >
> > > >> Hi Bryan,
> > > >>
> > > >> I found my problem for #2: I inadvertentlyh ad "bokeh serve" running in another terminal window. Also, I was mistakenly stopping "bokeh serve" with ^Z which does not properly shut it down, whereas ^C does do a full shut down.
> > > >>
> > > >> Ok, this leads to two more things:
> > > >>
> > > >> 1. If I do "bokeh serve line_animate_widget.py --port=5010 --show", the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do "bokeh serve line_animate_widget.py --show" except it takes 5-10 seconds for the browser window to show up. If I do "bokeh serve line_animate_widget.py" and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.
> > > >>
> > > >> 2. On the other hand, if I do "bokeh serve" in one terminal window and "python line_animate_widget.py" in another, the plot shows up immediately with working buttons and an animated line.
> > > >>
> > > >> Greg
> > > >>
> > > >> On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
> > > >> Greg,
> > > >>
> > > >> You get the error about the port because you left the first "bokeh serve" running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:
> > > >>
> > > >> bokeh serve line_animate_widget.py --port=5010 --show
> > > >>
> > > >> I'm not sure about the other behaviour with "html" or "json" that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.
> > > >>
> > > >> Bryan
> > > >>
> > > >>
> > > >> > >
> > > >> > > --
> > > >> > > 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 bokeh+un...@continuum.io.
> > > >> > > To post to this group, send email to bo...@continuum.io.
> > > >> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com\.
> > > >> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > > >> >
> > > >> >
> > > >> > --
> > > >> > 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 bokeh+un...@continuum.io.
> > > >> > To post to this group, send email to bo...@continuum.io.
> > > >> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io\.
> > > >> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > > >>
> > > >>
> > > >> --
> > > >> 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 bokeh+un...@continuum.io.
> > > >> To post to this group, send email to bo...@continuum.io.
> > > >> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io\.
> > > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > > >
> > > > --
> > > > 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 bokeh+un...@continuum.io.
> > > > To post to this group, send email to bo...@continuum.io.
> > > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io\.
> > > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> > >
> > > --
> > > 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 bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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 bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/16d5a1be-3984-4c73-9701-fdb56944d8a8%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/47c83144-45ff-4a82-9be2-86406bf36217%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Perfect! That’s exactly what I needed. Works fine now.

Thanks,

Greg

···

On Thursday, December 24, 2015 at 6:08:25 PM UTC-7, Bryan Van de ven wrote:

Hi Greg,

Updating the text for a Text glyph is like updating any other glyph, you need to update the data source for the glyph. Here is an example that updates text from a timeout callback:

    [https://github.com/bokeh/bokeh/blob/master/examples/plotting/server/timeout.py](https://github.com/bokeh/bokeh/blob/master/examples/plotting/server/timeout.py)

Let me know if that’s not enough to get started and I will try to work up a full example.

Also the good news about the app is if you write it for “bokeh serve” app style the students can run it locally and you could also potentially deploy it as a site with no changes.

Thanks,

Bryan

On Dec 24, 2015, at 6:54 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

That’s great about finding the instability issue. I’ll look forward to the next dev build. Also, I’ll get you some info as I work on the first app over the next week or so and the details about data, update rates, and interactions become clear. In the meantime I’ve run into an issue about how to update text on a plot during an animation. I have not been able to figure out how to do it, despite looking through documentation, examples, stack overflow, etc. Here is example code that illustrates what I mean:


from bokeh.plotting import figure, curdoc

from bokeh.models import ColumnDataSource

from bokeh.driving import linear

import numpy as np

Define a simple arbitrary pulse function. Let’s use 1/2 cycle of a cosine centered at 0,

and zero everywhere else.

def pulse(a):

if a < np.pi/2.0 and a > -np.pi/2.0:
    return np.cos(a)
else:
    return 0.0

Create a vectorized version of the pulse function so we can pass arrays as arguments

and automatically get an array back

vpulse = np.vectorize(pulse)

u = 1.0

t = 0.0

delta_t = 0.25

zmin = -30

zmax = 30

numpnts = 500

periodic_callback_time_ms = 50

x = np.linspace(zmin,zmax,numpnts)

y1 = vpulse(x - u*t)

p = figure(plot_width=600, plot_height=400, x_range=(zmin,zmax), y_range=(0,1.1), title=“Forward Propagating Pulse”)

l1 = p.line(x, y1, line_width=2, color=‘red’)

p.xaxis.axis_label = “Distance (m)”

p.yaxis.axis_label = “Pulse Amplitude (arb.)”

t1 = p.text(zmin+1.5, 1.0, text=[‘u = 1.0 m/s’], text_align=“left”, text_font_size=“10pt”)

t2 = p.text(zmin+1.5, 1.0-0.08, text=[‘t = {} s’.format(t)], text_align=“left”, text_font_size=“10pt”)

@linear(m=delta_t)

def update(new_t):

if playing:
    l1.data_source.data["y"] = vpulse(x - u*new_t)
    # Need something here to change the text in t2 that is displayed on the plot to be "t = {} s".format(new_t). I don't know how to access t2 to change its text.

playing = True

curdoc().add_periodic_callback(update, periodic_callback_time_ms)


What I don’t understand is how to change the text in t2 every time update() is called. If there is some documentation you could point me to, that would be great.

Thanks,

Greg

On Thursday, December 24, 2015 at 5:33:09 PM UTC-7, Bryan Van de ven wrote:

Hi Greg,

Both the “local” or “standalalone” (indivodual?) server approach and the notebook comms approach should be a breeze. Making a centrally deployed version should not be so bad either, but I understand the timing of the release might make that a tight schedule. I would be interested in learning more about the app though, to help have some example use-cases: what amounts of data, what sort of update rates and interactions, etc?

BTW I uncovered what I think is the last remaining annoying instability that was causing (very many) spurious events getting sent back to the server. There will be a new dev build with it, probably on the 26th.

Thanks,

Bryan

On Dec 24, 2015, at 3:00 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

Thanks for your comments and suggestions–this helps a lot to clarify the use cases. It looks like I may go with the stand alone server approach for students to run on their own computers, and have supplemental information in notebooks. Alternatively, if the notebook comms turns out well I could go with that. In any case, thanks again for all of your help.

Greg

On Thursday, December 24, 2015 at 9:58:07 AM UTC-7, Bryan Van de ven wrote:

On Dec 24, 2015, at 10:23 AM, Greg Nordin [email protected] wrote:

Hi Bryan,

Thanks for the link–I hadn’t noticed that section in the documentation before.

Just FYI as you finalize the release and examples, and write documentation, the reason I had push_session, etc. in the code is that they were in the example file line_animate_widget.py. Since I didn’t know what those commands did, or how they interacted with “bokeh serve”, it didn’t occur to me to question their presence. As part of the example file I thought that’s just how it was supposed to be. As you clean things up it would probably be helpful to fix the examples, or put some comment lines in explaining what the different commands do and under what circumstances they are needed (and when they’re not :slight_smile: ).

Agreed about comments. The examples in plotting/server are intended to be run as “bokeh serve” + “python foo.py” and the examples in app/ are intended to be run as “bokeh server foo.py” but we need to emphasize this in more places.

Also, I’m interested in doing animations from a notebook as well as standalone. I haven’t started to look at this, and it would be useful to know if this is possible, and, if so, how to accomplish it. As is probably clear from my comments, I don’t really understand the scope of “bokeh serve” and its usage compared to doing things in a notebook, and what commands need to be different in the two cases.

If your interest lies in developing things only for the notebook, I will mention that there is also a PR in flight for much improve use of notebook comms to update plots in the notebook without a bokeh server that may also be a useful option.

The use case I am driving for as I prepare for the new semester is to have a set of animations which students can start in a browser with minimal set up and click on sliders to change parameters that in turn immediately change the animation (i.e., change parameters in the calculations that drive the animations). The purpose is to let them play with the relationships in a visual way in order to understand the underlying physical phenomena (like how voltages propagate on transmission lines as the transmission line and load properties change). I suppose from a deployment perspective the easiest thing would be to just write the appropriate javascript code and make everything happen in-browser on the client side. I’m hoping to avoid this because I’m not prepared to teach myself javascript at this point, and would rather have a python-based solution. This has been my motivation for learning Bokeh. From what I can tell, it doesn’t make sense to run a server for a class of 60-70 students and have things calculated on the server. Instead, I’m thinking if I embed the animations in notebooks the students can run the notebooks on their own machines after installing Anaconda.

Yes, another point that we need to convey is one of the appropriate uses of the bokeh server is for “single user” or “local” use. In this sense it is alot like the jupyter notebbook server, in that its painless to run one locally at the drop of a hat. You run a server anytime you type “ipython notebook” and that is no big deal at all! For “local” apps the bokeh server is just like that. What I would suggest for you is that you make a “demo.py” and then every student can simply run “bokeh serve demo.py” or if you want to work in notebooks, they can run “bokeh serve” and then run your notebook. Or if you can use notebook comms, they would just run your notebook without a server running at all.

Now it is is possible you could publish/deploy an app centrally and have students just hit a URL for the deployed app. But there is a wide range of possibilities that have to be considered there. E.g., if your app is very compute intensive, you will have to scale out the deploy to be able to accommodate all the compute for the number of people that will hit the app at any given time – bokeh is not magic :slight_smile: – and that might be expensive, etc.

Thanks again for all of your help and patience–it’s been great getting such timely and useful feedback!

Greg

On Thursday, December 24, 2015 at 8:45:13 AM UTC-7, Bryan Van de ven wrote:
Hi Greg,

Awesome, I am very glad things are working. I also appreciate your patience and effort, this has been a very instructive and useful exchange.

Regarding docs, there is a little bit at the current “dev” deploy of the docs:

    [http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html](http://bokeh.pydata.org/en/dev/docs/user_guide/cli.html)

However, I am not sure it covers much more than you already know. The code freeze for the release is soon, and we will be focused exclusively on documentation and final testing after that. The good news is that the new server “makes good sense” in my head, and I already have a fairly well formed idea of the things the need to be written (we just need to do the writing!)

As Havoc mentions, calling “bokeh serve” with a push_session, pull_session, etc is detectable, so we will add a loud warning.

BTW the distinction between using “bokeh serve foo.py” and using “bokeh serve” + “python foo.py” is obviously an important distinction we need to draw out very clearly. I do think we need to find some good vocabulary to consistently describe these two situations with. If you (or anyone else) has any opinions or suggestions, they are most welcome (naming is hard).

Bryan

On Dec 24, 2015, at 2:07 AM, Greg Nordin [email protected] wrote:

Ahh, that was the problem. I still had push_session(), show(), and loop_until_closed() in the code (I didn’t notice these weren’t in Bryan’s code). Thanks Havoc & Bryan!

Is there documentation somewhere about bokeh serve and how to work with it?

Greg

On Wednesday, December 23, 2015 at 10:06:10 PM UTC-7, Bryan Van de ven wrote:
Oh! Right, Greg, are you running the modified version of line_animate_widget.py that I included in my response a few messages back? It had all of the things Havoc mentioned (output_server, push_session, etc) stripped out. That is what you need to be using. The new server command is actually very nice in that you can write scripts without having to choose and output method – you just run “bokeh serve” or “bokeh html” or “bokeh json” on the exact same script and it does the right thing. But you have to explicitly not choose, i.e., not have output_server, etc in the script.

Bryan

On Dec 23, 2015, at 10:20 PM, Havoc Pennington [email protected] wrote:

Don’t know if this is your issue, but the same script can’t be used in both ways.
If the script has output_server() and push() or show() in it, or push_session() or pull_session() in it, it’s intended to be run outside the server and push a document to the server from outside.

If the script only modifies curdoc() with no explicit output/push/show then it’s intended to be run inside the server by passing it to bokeh serve.

push_session and pull_session should be added to this list to give an error in this case:
https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/script.py#L15

Havoc

On Dec 23, 2015, at 6:27 PM, Greg Nordin [email protected] wrote:

Hi Bryan,

I found my problem for #2: I inadvertentlyh ad “bokeh serve” running in another terminal window. Also, I was mistakenly stopping “bokeh serve” with ^Z which does not properly shut it down, whereas ^C does do a full shut down.

Ok, this leads to two more things:

  1. If I do “bokeh serve line_animate_widget.py --port=5010 --show”, the plot is opened immediately in a browser window but there are no start and stop buttons and the line plot is static. The same happens when I do “bokeh serve line_animate_widget.py --show” except it takes 5-10 seconds for the browser window to show up. If I do “bokeh serve line_animate_widget.py” and then manually open localhost:5006/line_animate_widget in my browser, it again takes 5-10 seconds to show up with no buttons or animation.

  2. On the other hand, if I do “bokeh serve” in one terminal window and “python line_animate_widget.py” in another, the plot shows up immediately with working buttons and an animated line.

Greg

On Wednesday, December 23, 2015 at 3:53:05 PM UTC-7, Bryan Van de ven wrote:
Greg,

You get the error about the port because you left the first “bokeh serve” running. You can stop it (Ctrl-C) or you can specify a different port with the --port option when you run, e.g.:

    bokeh serve line_animate_widget.py --port=5010 --show

I’m not sure about the other behaviour with “html” or “json” that seems surprising to me too. My only thought offhand is that it is opening up the animation you left running from part 1. again.

Bryan


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/CAC%2B_nE3iAsVCDPY7c0qY9PUYh8_01MF10e%2B-auXrR6rMXEL3fw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/6f7c4076-5779-4ec1-915f-ca6191e643fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/a0402f4f-349c-4195-8000-45197a8ce9d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/21415F08-0721-49AD-9DBA-9B1CE3E23958%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/f14d3233-2308-4d38-8785-4c8a7c6233eb%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/567f8c3b-1b0f-4fd6-a791-95488aac7a87%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/16d5a1be-3984-4c73-9701-fdb56944d8a8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


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/47c83144-45ff-4a82-9be2-86406bf36217%40continuum.io.

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