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
feat: Add lifecycle hooks to VSCode and Jupyterlab Workspaces to provide persistence of conda, pip, and extensions. #646
Conversation
- Added lifecycle hooks to template - This enables persistence of conda, pip, and jupyter labextensions.
- Added lifecycle hooks to template - This enables persistence of conda, pip, and vscode extensions.
@aleksandrmelnikov getting this error when running the migration. Same error when I directly copy/paste the template:
|
Please don't merge this yet, need to move the docs to another repo. |
It looks like using this approach for restoring pip/conda packages is adding an extra 10 mins delay (with JupyterLab). Need to verify whether this is because conda is taking a long time to restore or if it's somewhere else. |
It seems like There is an open issue for this: conda/conda#10218 |
Good find on the "update all packages".
|
Possibly, or if there is a way to only export user installed packages... |
- Otherwise, the extension installation process also kicks off a production minimization of code, which takes minutes. - This leads to Jupyterlab Workspace taking ~10 minutes to resume, even if no new extensions had been installed.
@rushtehrani Note the change in the migration to jupyterlab. This should fix the long start time for it. Time command to debug postStart hook: condayml="/data/.environment.yml";
jupytertxt="/data/.jupexported.txt";
if [ -f "$condayml" ]; then { time conda env update -f $condayml;} 2>> /data/time.txt; fi;
if [ -f "$jupytertxt" ]; then { time cat $jupytertxt | xargs -n 1 jupyter labextension install --no-build;} 2>> /data/juptime.txt; fi; VScode condayml="/data/.environment.yml";
vscodetxt="/data/.vscode-extensions.txt";
if [ -f "$condayml" ]; then { time conda env update -f $condayml;} 2>> /data/time.txt; fi;
if [ -f "$vscodetxt" ]; then { time cat $vscodetxt | xargs -n 1 code-server --install-extension;} 2>> /data/juptime.txt; fi; |
- This is SQL and will never evaluate to true. These templates are go migrations, not sql based. See onepanelio#646 for context.
All issues should be resolved. |
Getting the message below after resuming a paused JupyterLab workspace. I'm not sure if the |
- This ensures all the extensions installed with "--no-build" will be compiled in one go, instead of individually.
@rushtehrani I was able to recreate this error and I pushed up a fix.
The time to install and build seems to be ~5-6 minutes. root@jup2-0:/data# tail jupbuild.txt
[LabBuildApp] JupyterLab 2.2.5
[LabBuildApp] Building in /opt/conda/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
real 2m37.921s
user 3m25.626s
sys 0m48.704s
root@jup2-0:/data# tail time.txt
Please update conda by running
$ conda update -n base conda
real 2m8.134s
user 1m21.518s
sys 0m5.535s
root@jup2-0:/data# |
- We want it to run only if the installation succeeds.
Based on my testing:
The last option seems like the best option as far as startup times, however since it doesn't minimize the extension files, it could slow down browser load times. Question: is there a way to save JupyterLab extensions in a different directory that is mounted vs a directory on OS disk? |
Let me take a look at changing the jupyter installation directory. |
Sounds good, if that is not option, I think our best bet is to set the |
@rushtehrani Investigated this a bit. What this does is dictate where jupyterlab installs it's assets and extensions.
We can change that to If we go ahead and save the extensions and jupyter to the mounted disk, we have to make sure the workspace resumes and uses that directory for jupyterlab.
I'm testing if JUPYTERLAB_DIR will work on start-up. But is your intent to save the extensions to that volume on shut-down? |
@aleksandrmelnikov this is only going to be useful if it allows us to either bypass build or reduce the time it takes to build the extensions. If it does, then putting it in The intent is to always save the data there and not have to move it on start or shutdown. How would this work with extensions already installed in the image. Can we separate user installed extensions? |
- This is a trade-off to reduce workspace start-up time, but increase browser load times for Jupyterlab.
Per discussion here: https://onepanelio.slack.com/archives/GJ88JMG9E/p1603913216187400 We're going to go ahead and use the --minimize=False flag as a trade-off. |
What this PR does:
Adds a design document of the implementation.
Adds migrations to add lifecycle hooks into the workspace templates.
Which issue(s) this PR fixes:
Fixes #623
Special notes for your reviewer:
Checklist
Please check if applies
Required