Git Product home page Git Product logo

Comments (10)

danlester avatar danlester commented on September 23, 2024

Hi there! Where exactly are you running the jhsingle_native_proxy command? If it is within a JupyterLab server session then that won't help. It needs to be run by JupyterHub instead of a JupyterLab server. To do that you would need to change the c.Spawner.cmd configuration from jupyterhub-singleuser (which is essentially jupyterlab) to jhsingle-native-proxy or similar. And you would also need to set c.Spawner.args appropriately.

However, unless there is a way to change this dynamically, you will be replacing jupyterlab with the single WebApp.py in place of everyone's JupyterLab session, so JupyterLab would never be available any more. That's what cdsdashboards is designed to do - give a UI and controls so some servers are jupyterlab and others are specific webapps (dashboards) as defined within JupyterHub by users.

I hope this explains it all a bit more. Maybe more config and explaining where you are running things might help me understand if/where you're getting confused.

from jhsingle-native-proxy.

nmearl avatar nmearl commented on September 23, 2024

@danlester Thanks so much for the overview. Our TLJH is running in a Docker container right now, and we've attempted to edit the startup behavior by including a /opt/tljh/config/jupyterhub_config.d/spawner.py script. This is where we can't seem to get the expected behavior. Inside, we've tried variations of:

c.Spawner.cmd = 'jhsingle-native-proxy'
c.Spawner.args = ['--destport 12000 voila ./WebApp.ipynb {--}port={port} {--}no-browser {--}Voila.server_url=/ {--}Voila.base_url={base_url}/ {--}debug']

But get 404's or 500's in response. Any advice would be appreciated!

from jhsingle-native-proxy.

danlester avatar danlester commented on September 23, 2024

Maybe this isn't representative of everything you've tried anyway, but where did you get port 12000 from? It would make sense to leave jhsingle-native-proxy to choose this internal port for itself to avoid clashes (--destport 0).

I'm not 100% sure but I think you need to pass an array of strings to args. From cdsdashboards which implements a spawner for Voila, these are the arguments I use there:

            'args': ['--destport=0', 'python3', '{-}m','voila', '{presentation_path}',
                '{--}port={port}',
                '{--}no-browser',
                '{--}Voila.base_url={base_url}/',
                '{--}Voila.server_url=/',
                '{--}Voila.ip=0.0.0.0',
                '{--}Voila.tornado_settings', 'allow_origin={origin_host}',
                '--progressive',
                '--ready-check-path=/voila/static/'
                ]

You might also add the debug arg to jhsingle-native-proxy itself:

c.Spawner.cmd = ['jhsingle-native-proxy', '--debug']

but that's not very helpful if you can't see the logs anywhere anyway!

If this doesn't help, I think finding a way to get logs is the next step.

from jhsingle-native-proxy.

nmearl avatar nmearl commented on September 23, 2024

When we run the above (or something) similar, the jupyter hub is unable to spawn a server:
Screen Shot 2022-05-05 at 12 22 45

The Docker TLJH sets up the Juptyer hub to be accessed at localhost:12000, so we were trying to force the endpoint to be consistent, given that the address shown in the screenshot is wrong.

Also, the python script containing the spawner args did not like the {--} syntax, so we instead went with a bash script containing

python3 -m jhsingle_native_proxy.main --destport 0 voila $presentation_path {--}port={port} {--}no-browser {--}Voila.server_url=/ {--}Voila.base_url={base_url}/ {--}debug {--}Voila.ip=0.0.0.0 {--}Voila.tornado_settings allow_origin={origin_host} --progressive --ready-check-path=/voila/static/

with c.Spawner.cmd = '/usr/local/bin/voila-wrapper'.

Unfortunately, it results in the screenshot above.

from jhsingle-native-proxy.

danlester avatar danlester commented on September 23, 2024

In the example in your screenshot, you can see that JupyterHub has allocated the port 36059 for this particular server. It will generate one for each JupyterLab server that is started. There has to be a way for that to be passed into your script so that jhsingle-native-proxy can be serving on that port and then JupyterHub will be able to reach it.

So in that example, you need to end up with jhsingle-native-proxy --port 36059 ... somehow. Further to that, jhsingle-native-proxy itself will run your voila process on yet another (different) port, but that doesn't matter as long as you don't attempt to conflict with an already-used port (such as 1200 which is almost certainly already in use by JupyterHub). So the default of --destport 0 is fine (pick a random unused port) - as long as jhsingle-native-proxy can pass on {port} to voila in the command-line when it starts Voila.

Your voila-wrapper script must find a way to interpret the --port parameter that JupyterHub will pass to it, and probably just pass it on to jhsingle-native-proxy. As it stands, your wrapper script does not pass any --port to jhsingle-native-proxy. It only passes voila $presentation_path {--}port={port} which is another layer down - i.e. jhsingle-native-proxy's destport is passed to voila - that bit's all fine.

from jhsingle-native-proxy.

nmearl avatar nmearl commented on September 23, 2024

Okay, thanks for the insight. I've successfully been able to pass down the jupyter server port to --port, however, now the hub hangs at "Server ready at /user/admin":
Screen Shot 2022-05-12 at 14 04 37

This is using jhsingle-native-proxy --destport 0 --port $port voila /home/jupyter-admin/Presentation.ipynb {--}port={port} {--}no-browser {--}Voila.base_url={base_url}/ {--}debug {--}Voila.server_url=/

If I include {--}Voila.tornado_settings allow_origin={original_host}, I get a 500 response.

from jhsingle-native-proxy.

danlester avatar danlester commented on September 23, 2024

Getting the 500 response is actually pretty good progress! It probably means something is going wrong within the Voila app, e.g. it can't import a Python module. Maybe find a way to take a look at logs there.

from jhsingle-native-proxy.

nmearl avatar nmearl commented on September 23, 2024

Hmm, unfortunately it doesn't seem to be an issue with the installed packages. I can run the notebook fine by itself, and can create a voila render if I click the "Voila" button on the notebook page.

But no matter what, I can't seem to get it to work with the jusingle-native-proxy. I had done a fresh re-install of TLJH, and even with {--}Voila.tornado_settings allow_origin={original_host}, the hub just hangs after starting the server (see previous screenshot).

I can, however, get the voila app to render just calling voila directly in the c.Spawner.cmd, but as I understand, this method still requires the use of Jupyter notebook, and can't interface with the authentication.

from jhsingle-native-proxy.

nmearl avatar nmearl commented on September 23, 2024

I seem to have solved the issue. It wasn't until I added {--}VoilaConfiguration.http_keep_alive_timeout=30 {--}VoilaExecutor.iopub_timeout=100 that the webapp finally loaded.

Thanks for all your help.

from jhsingle-native-proxy.

danlester avatar danlester commented on September 23, 2024

Great to hear you made progress - thanks for letting us know the details.

from jhsingle-native-proxy.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.