Connecting to Bokeh Server using multiple browser tabs

I am fairly new to Bokeh and am trying to stream data to a Bokeh server. I stand up a Bokeh server using: bokeh serve

Then in a separate script, I connect to the server, create a new session and start streaming data. When I open on a single firefox tab I see the data streaming. However, when I connect on an additional tab (simulating multiple users connecting to the Bokeh server) it is frozen. What is the cause of this and what can I do so that “multiple users” can connect and view the streaming data?

from bokeh.client import push_session
from bokeh.document import Document
from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import figure
import time

session = push_session(Document(), session_id=‘lynx’, url=“http://localhost:5006”)

data = ColumnDataSource(dict(x=, y=))

plot = figure()
plot.line(‘x’, ‘y’, source=data)
session.document.add_root(plot)

for i in xrange(1000):
data.stream({‘x’: [i], ‘y’: [i]})
print(‘Finished Iteration’, i)
time.sleep(2)

For multiple users, you are always really going to want to use the "full native server" app, i.e. "bokeh serve myapp.py" style, rather than using bokeh.client and push_session in a separate python proecess. There are lots of examples under examples/app in the GitHub repo.

Thanks,

Bryan

···

On Oct 18, 2016, at 6:53 PM, bherman <[email protected]> wrote:

I am fairly new to Bokeh and am trying to stream data to a Bokeh server. I stand up a Bokeh server using: bokeh serve

Then in a separate script, I connect to the server, create a new session and start streaming data. When I open on a single firefox tab I see the data streaming. However, when I connect on an additional tab (simulating multiple users connecting to the Bokeh server) it is frozen. What is the cause of this and what can I do so that "multiple users" can connect and view the streaming data?

from bokeh.client import push_session
from bokeh.document import Document
from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import figure
import time

session = push_session(Document(), session_id='lynx', url="http://localhost:5006")

data = ColumnDataSource(dict(x=, y=))

plot = figure()
plot.line('x', 'y', source=data)
session.document.add_root(plot)

for i in xrange(1000):
    data.stream({'x': [i], 'y': [i]})
    print('Finished Iteration', i)
    time.sleep(2)

--
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/570c59ef-5b49-42da-9383-da9d22d65305%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I was trying to do that initially, but I am not sure how to handle my use case. The purpose of my example is to stream data (say memory of a python process) from a python code to the bokeh server to that users can monitor the memory of each forked process of their simulation. As a start, users will only view the plots on the Bokeh server. How can I do this from your perspective?

Thanks,

-Bryan

···

On Tuesday, October 18, 2016 at 8:24:25 PM UTC-4, Bryan Van de ven wrote:

For multiple users, you are always really going to want to use the “full native server” app, i.e. “bokeh serve myapp.py” style, rather than using bokeh.client and push_session in a separate python proecess. There are lots of examples under examples/app in the GitHub repo.

Thanks,

Bryan

On Oct 18, 2016, at 6:53 PM, bherman [email protected] wrote:

I am fairly new to Bokeh and am trying to stream data to a Bokeh server. I stand up a Bokeh server using: bokeh serve

Then in a separate script, I connect to the server, create a new session and start streaming data. When I open on a single firefox tab I see the data streaming. However, when I connect on an additional tab (simulating multiple users connecting to the Bokeh server) it is frozen. What is the cause of this and what can I do so that “multiple users” can connect and view the streaming data?

from bokeh.client import push_session

from bokeh.document import Document

from bokeh.models.sources import ColumnDataSource

from bokeh.plotting import figure

import time

session = push_session(Document(), session_id=‘lynx’, url=“http://localhost:5006”)

data = ColumnDataSource(dict(x=, y=))

plot = figure()

plot.line(‘x’, ‘y’, source=data)

session.document.add_root(plot)

for i in xrange(1000):

data.stream({'x': [i], 'y': [i]})
print('Finished Iteration', i)
time.sleep(2)


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/570c59ef-5b49-42da-9383-da9d22d65305%40continuum.io.

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

You may want to check
out how dask uses bokeh :

              dask is open source

and you can poke around the code :

                        But I'd say

the essen ce is that they
create plots with an empty data source, then they have a
periodic callback that looks
for n ew
data and if there is any
shoves it in the data source
and then the plot updates.

HTH, Bird

···

https://youtu.be/PAGjm4BMKlk?t=2m54shttps://github.com/dask/distributed/tree/master/distributed/bokeh
On 10/18/16 5:55 PM, bherman wrote:

    I was trying to do that initially, but I am not

sure how to handle my use case. The purpose of my example is to
stream data (say memory of a python process) from a python code
to the bokeh server to that users can monitor the memory of each
forked process of their simulation. As a start, users will only
view the plots on the Bokeh server. How can I do this from your
perspective?

    Thanks,



    -Bryan



    On Tuesday, October 18, 2016 at 8:24:25 PM UTC-4, Bryan Van de

ven wrote:

      For

multiple users, you are always really going to want to use the
“full native server” app, i.e. “bokeh serve myapp.py” style,
rather than using bokeh.client and push_session in a separate
python proecess. There are lots of examples under examples/app
in the GitHub repo.

      Thanks,




      Bryan



      > On Oct 18, 2016, at 6:53 PM, bherman <[email protected]          >

wrote:

      >

      > I am fairly new to Bokeh and am trying to stream data to

a Bokeh server. I stand up a Bokeh server using: bokeh serve

      >

      > Then in a separate script, I connect to the server,

create a new session and start streaming data. When I open on
a single firefox tab I see the data streaming. However, when I
connect on an additional tab (simulating multiple users
connecting to the Bokeh server) it is frozen. What is the
cause of this and what can I do so that “multiple users” can
connect and view the streaming data?

      >

      > from bokeh.client import push_session


      > from bokeh.document import Document


      > from bokeh.models.sources import ColumnDataSource


      > from bokeh.plotting import figure


      > import time


      >

      > session = push_session(Document(), session_id='lynx',

url="http://localhost:5006 ")

      >

      > data = ColumnDataSource(dict(x=[], y=[]))


      >

      > plot = figure()


      > plot.line('x', 'y', source=data)


      > session.document.add_root(          plot)


      >

      > for i in xrange(1000):


      >     data.stream({'x': [i], 'y': [i]})


      >     print('Finished Iteration', i)


      >     time.sleep(2)


      >

      > --

      > 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/570c59ef-5b49-42da-9383-da9d22d65305%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/570c59ef-5b49-42da-9383-da9d22d65305%40continuum.io)          .


      > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](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/614b27ad-979e-431f-8417-66f8457f38a3%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/614b27ad-979e-431f-8417-66f8457f38a3%40continuum.io?utm_medium=email&utm_source=footer).

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


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

I am struggling with when to use
bokeh serve --show myapp.py

vs

bokeh serve

and running my app from python.

What at the use cases for these two?

I am fairly new to bokeh but so far I think it is great.

In searching the postings I came across Bryan’s comment above about using

" … the “full native server” app, i.e. “bokeh serve myapp.py” style, rather than using bokeh.client and push_session “”

where can I go to read more about this distinction. I believe it is relevant to my struggles.

I would like to run my app and have multiple people connect to it and use it.

I’d be happy to provide more detail as needed.

Thanks greatly and best regards

  • john

PS Is there any other “support” for bokeh users aside from the documentation and the mailing list?

···

On Tuesday, October 18, 2016 at 8:24:25 PM UTC-4, Bryan Van de ven wrote:

For multiple users, you are always really going to want to use the “full native server” app, i.e. “bokeh serve myapp.py” style, rather than using bokeh.client and push_session in a separate python proecess. There are lots of examples under examples/app in the GitHub repo.

Thanks,

Bryan

On Oct 18, 2016, at 6:53 PM, bherman [email protected] wrote:

I am fairly new to Bokeh and am trying to stream data to a Bokeh server. I stand up a Bokeh server using: bokeh serve

Then in a separate script, I connect to the server, create a new session and start streaming data. When I open on a single firefox tab I see the data streaming. However, when I connect on an additional tab (simulating multiple users connecting to the Bokeh server) it is frozen. What is the cause of this and what can I do so that “multiple users” can connect and view the streaming data?

from bokeh.client import push_session

from bokeh.document import Document

from bokeh.models.sources import ColumnDataSource

from bokeh.plotting import figure

import time

session = push_session(Document(), session_id=‘lynx’, url=“http://localhost:5006”)

data = ColumnDataSource(dict(x=, y=))

plot = figure()

plot.line(‘x’, ‘y’, source=data)

session.document.add_root(plot)

for i in xrange(1000):

data.stream({'x': [i], 'y': [i]})
print('Finished Iteration', i)
time.sleep(2)


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/570c59ef-5b49-42da-9383-da9d22d65305%40continuum.io.

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