voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.41k stars 503 forks source link

Preloading kernels / enabling a pool of kernels #30

Open astrojuanlu opened 5 years ago

astrojuanlu commented 5 years ago

I am experimenting with a moderately complex notebook (~10 widgets, among them an ipyleaflet map) and I have seen that, from first GET request to the end of the load, it takes about 1 minute, and sometimes it gives timeouts when loading the JavaScript modules. I wonder if there would be some way to "preload" a pool of kernels to help accelerate page show times. Not sure if this is similar to https://github.com/QuantStack/voila/issues/5.

SylvainCorlay commented 5 years ago

A visual indication that things are loading would be a first step.

astrojuanlu commented 5 years ago

True. At the moment I'm planning to simulate that by embedding the voila HTML in an iframe, and putting some loading indication outside.

maartenbreddels commented 5 years ago

I see a few options here:

On the last point, I also want to bring up a use cases that we (me @SylvainCorlay and @pbugnion) discussed yesterday. If you want to render voila in a Jupyter Lab panel (is that the right word?) you only want to render the 'body' part of the HTML.

Also, another use case I have in mind is to have a template served directly, no cell output will be rendered, but the template itself takes care of rendering the widgets at specific locations.

Some food for thought.

parente commented 5 years ago

The jupyter/kernel_gateway has a preheated kernel pool for its notebook-as-an-API mode (https://jupyter-kernel-gateway.readthedocs.io/en/latest/http-mode.html). Maybe something can be ported to jupyter_server from there?

maartenbreddels commented 5 years ago

Thanks, that is good to know!

marscher commented 3 years ago

Since almost three years passed since the last update of this issue I kindly ask if there is any progress on this. I'd be interested in forking a "preloaded" ipykernel. This kernel would just heat up the imports, which take some time in my case.

maartenbreddels commented 3 years ago

If you follow the last reference (https://github.com/voila-dashboards/voila/pull/820) you see it links to https://github.com/voila-dashboards/hotpot_km (https://github.com/voila-dashboards/hotpot_km/pull/8 might help settings things up)

marscher commented 3 years ago

Thanks for the quick reply. I should have red this more intensively :) Will check it out!