Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panels appearing in wrong position (end of web page) when serving a jupyter notebook with multiple processes #791

Closed
olbermann opened this issue Nov 15, 2019 · 6 comments
Labels
type: bug Something isn't correct or isn't working

Comments

@olbermann
Copy link

olbermann commented Nov 15, 2019

FOLLOW THESE INSTRUCTIONS CAREFULLY

ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY

The issue tracker is NOT the place for general support. For questions and technical assistance, ask us on Gitter.

For defects or deficiencies, please provide ALL OF THE FOLLOWING:

ALL software version info (Panel, bokeh, python, notebook, OS, browser, any other relevant packages)

Python 2.7 on ubuntu 18.04,
Chromium and Firefox browsers
bokeh==1.3.4
jupyter==1.0.0
pandas==0.19.2
panel==0.6.2
tornado==5.1.1

Description of expected behavior and the observed behavior

In a notebook I generate a panel template and make it servable.
Then I run 'python -m panel serve sample.ipynb --num-procs 5'.

Now the first time I load the corresponding page the panels are included in the div
where they are supposed to appear. However, in a second browser or second tab
or after CTRL+R the panels are added to the bottom of the page instead of the position
in the expected div tag.

Am I doing something wrong or is this a bug?

Complete, minimal, self-contained example code that reproduces the issue

sample.ipynb:

import pandas as pd
import panel as pn
pn.extension()

dfs={}
panes = {}
for i in range(4):
    dfs[i]=pd.DataFrame(data=[[i,i],[i,i]])
    panes[i]=pn.Pane(dfs[i])

template_string = """
{% extends base %}
<!-- goes in body -->
{% block contents %}
<div class="container">
""" + "\n".join(["""
  <h2>Dataframe """ + str(pane_no) + """</h2>
  <div class="row">
    
    <div class="col-sm">
      {{ embed(roots.""" + "P" + str(pane_no) +
""") }}
    </div>
  </div>
""" for pane_no in panes]) + """
</div>
{% endblock %}
"""
template = pn.Template(template=template_string)
for pane_no in panes:
    template.add_panel("P" + str(pane_no), panes[pane_no])
template.servable()

command line:
python -m panel serve sample.ipynb --num-procs 5

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

grafik

@olbermann olbermann added the TRIAGE Default label for untriaged issues label Nov 15, 2019
@olbermann
Copy link
Author

Same behaviour with
panel==0.6.4
bokeh==1.4.0
notebook==6.0.2
holoviews==1.12.6
pandas==0.25.3
python 3.7.3 on ubuntu 18.04, firefox

@philippjfr philippjfr added type: bug Something isn't correct or isn't working and removed TRIAGE Default label for untriaged issues labels Dec 20, 2019
@philippjfr philippjfr added this to the v0.7.1 milestone Dec 20, 2019
@philippjfr
Copy link
Member

philippjfr commented Dec 20, 2019

Thanks for reporting this, certainly quite bizarre.

@MarcSkovMadsen
Copy link
Collaborator

I have a similar problem. #897

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Dec 20, 2019

I've tried removing --num-procs 0 in my Dockerfile i.e. changing

ENTRYPOINT [ "panel", "serve", "app.py", "--address", "0.0.0.0", "--port", "80", "--num-procs", "0"]

to

ENTRYPOINT [ "panel", "serve", "app.py", "--address", "0.0.0.0", "--port", "80"]

and the problem goes away.

I've got this response on the gitter channel

When you connect to a bokeh server with an HTTP(S) request Bokeh returns a template, and that template immediately turns arounds and makes a websocket connection back to the Bokeh server. But with --num-procs > 1 there is no guarantee that the websocket connection lands on the same original process. That's why e.g. the full HTTP request is not available in the app code— if the websocket lands on a new process, that new process never saw the HTTP request, knows nothing about, can't even in principle provide it.

@philippjfr philippjfr modified the milestones: v0.7.1, v0.8.0, v0.9.0 Jan 16, 2020
@philippjfr
Copy link
Member

This will be fixed by changes in bokeh 2.0, so I've reassigned to the next major milestone which should coincide with bokeh 2.0.

@philippjfr philippjfr modified the milestones: v0.9.0, v0.9.2 Mar 16, 2020
@philippjfr
Copy link
Member

This was fixed as part of Bokeh 2.0 and therefore Panel 0.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

3 participants