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

Pre-loading notebooks? #318

Closed
ericmjl opened this issue Jul 23, 2019 · 4 comments
Closed

Pre-loading notebooks? #318

ericmjl opened this issue Jul 23, 2019 · 4 comments

Comments

@ericmjl
Copy link

ericmjl commented Jul 23, 2019

First off, wanted to ping in and say that I was able to display a bokeh plot embedded in a panel tab served up by voila. Voila! 😄

I have one question regarding load times, when myself and my colleague @zbarry did some debugging. Some notebooks are inherently slow to run, e.g. the imports take some time. For user experience, might it be possible to pre-load a notebook kernel right after launching voila? While I'm not sure how exactly the implementation would look, might it look like a flag that enables "always keeping one extra jupyter kernel running" that a new user could connect to, rather than having a kernel created upon HTTP request?

@timkpaine
Copy link
Member

How would you do user authentication? Let's say your notebook fetches data, how would you ensure that when a given user gets to the web page, that they had the requisite permissions to run that code to access the data in the first place

@ericmjl
Copy link
Author

ericmjl commented Jul 23, 2019

Hmmm, I'm not quite sure how the authentication story would work, I have to admit. Most of how I've used voila in the past doesn't involve passwords and the likes, and the way I've used it with my colleagues before been 'here's the URL - have fun with it!'

@maartenbreddels
Copy link
Member

@timkpaine good point about authentication.

@ericmjl
There are some thoughts about this.

  • Pre-start kernels (saves startup time of a kernel, starting Python, setting up zmq socket etc, and various imports)
  • Pre-import modules, e.g. importing numpy,scipy,mpl (but not adding them to the namespace, just make sure they are in sys.modules)
  • Fork kernels. Execute a notebook once, then for every request fork that final state. A POC can be found here: WIP: Feature: fork kernel ipython/ipykernel#410 . This can be seen as a cache of processes, where the cache key is notebook path, and possibly other values, such as credentials, as Tim mentioned.

I think all of this should not be turned on by default, but I'd like to see this configurable somehow. Especially in the simple case of 1 voila, 1 notebook, no login, the forking would work great.

@maartenbreddels
Copy link
Member

See #30, better to continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants