From 56d8f0eeed7897ba8e9f9e9726b7ffce3ed180ea Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 12 May 2025 18:34:06 +0900 Subject: [PATCH 1/5] Add new BEP about app injection --- drafts/BEP1001-app-injection.md | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 drafts/BEP1001-app-injection.md diff --git a/drafts/BEP1001-app-injection.md b/drafts/BEP1001-app-injection.md new file mode 100644 index 0000000..2d8f933 --- /dev/null +++ b/drafts/BEP1001-app-injection.md @@ -0,0 +1,38 @@ +--- +Author: Joongi Kim (joongi@lablup.com) +Status: Draft +--- + +# App Injection + +## Motivation + +* Decouple the update cycle of container apps (e.g., Jupyter) and the container images (e.g., NGC PyTorch) +* Allow users to pin a desired version of the apps (e.g., Jupyter Notebook v7 has many breaking changes and most nbextensions do not work) + +## Proposed structure + +### App Package + +- `service-def.json` (mounted as `/opt/kernel/service-defs/{app-name}.json`) +- `app/` (mounted as `/opt/{app-name}/`) + +### Updates to Manager API + +- List the available app packages +- Auto-populate required app packages into agent nodes when creating sessions and kernels + (or, we need to assume that we have consistent app package files in all agent nodes...) +- Specify the app packages when creating sessions +- Perform a compatibility check by comparing some metadata + (e.g., is it a static build or does it depend on a specific glibc version?) + +### Updates to Agent API + +# Migration of Existing Apps + +## Jupyter + +Recently Jupyter has changed its configuration format. (TODO: issue link) + +We need to generate version-specific `.cfg` file, by replacing the service definition +to execute an (injected) script instead of directly writing the configuration file from the embedded template string. From 6dca8d3d1aa9cda69aabbe21c8ce58f9391405c9 Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 12 May 2025 18:39:21 +0900 Subject: [PATCH 2/5] Add more details --- drafts/BEP1001-app-injection.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drafts/BEP1001-app-injection.md b/drafts/BEP1001-app-injection.md index 2d8f933..f690661 100644 --- a/drafts/BEP1001-app-injection.md +++ b/drafts/BEP1001-app-injection.md @@ -28,11 +28,29 @@ Status: Draft ### Updates to Agent API -# Migration of Existing Apps +- TODO -## Jupyter +## Migration of Existing Apps + +### Overall technical issues + +- If we mount the extracted app directories as _read-only_, some apps may not work as expected. +- If the app depends on directories that only root can write to, it may not work as expected. +- The delay required to load and extract the app packages +- Managing the cached extracted app packages within the disk size limit of agents + +### Jupyter Recently Jupyter has changed its configuration format. (TODO: issue link) We need to generate version-specific `.cfg` file, by replacing the service definition to execute an (injected) script instead of directly writing the configuration file from the embedded template string. + +**Design discussion:** +- Make a wheelhouse directory and install them when first-launching the app + _vs._ Make a pre-installed site-packages directory and mount subdirs into `/opt/backend.ai`? + +### VSCode + +- Could we make a statically built app package? +- Could we allow users to install their own extensions in container while the app package is read-only? From 8a3ce6bc6c7040e45a09853a686d962a19e574a6 Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 12 May 2025 18:40:29 +0900 Subject: [PATCH 3/5] More... --- drafts/BEP1001-app-injection.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drafts/BEP1001-app-injection.md b/drafts/BEP1001-app-injection.md index f690661..318fae4 100644 --- a/drafts/BEP1001-app-injection.md +++ b/drafts/BEP1001-app-injection.md @@ -15,7 +15,7 @@ Status: Draft ### App Package - `service-def.json` (mounted as `/opt/kernel/service-defs/{app-name}.json`) -- `app/` (mounted as `/opt/{app-name}/`) +- `app/` (mounted as `/opt/apps/{app-name}/`) ### Updates to Manager API @@ -38,6 +38,7 @@ Status: Draft - If the app depends on directories that only root can write to, it may not work as expected. - The delay required to load and extract the app packages - Managing the cached extracted app packages within the disk size limit of agents +- Should we ship PBS (python-build-standalone) individually by each app? ### Jupyter From 755b14132a9a572dfd1af808bfd32558745a837f Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 12 May 2025 18:44:50 +0900 Subject: [PATCH 4/5] details for jupyter --- drafts/BEP1001-app-injection.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drafts/BEP1001-app-injection.md b/drafts/BEP1001-app-injection.md index 318fae4..970cd5d 100644 --- a/drafts/BEP1001-app-injection.md +++ b/drafts/BEP1001-app-injection.md @@ -50,6 +50,9 @@ to execute an (injected) script instead of directly writing the configuration fi **Design discussion:** - Make a wheelhouse directory and install them when first-launching the app _vs._ Make a pre-installed site-packages directory and mount subdirs into `/opt/backend.ai`? +- We must install `ipython` at least in the _target_ Python (the Python already-installed inside the container image) upon the first launch. + We also have to generate the metakernel spec (like what we does in [backend.ai-kernels](https://github.com/lablup/backend.ai-kernels/blob/075ca379c7db279f69d4485bf014750af0bb6fdc/python/Dockerfile.3.11-ubuntu22.04#L135-L137)). + We need an explicit error reporting when this fails. ### VSCode From 87f4818c7ad0ad1d2fe6a876237fa17a22886b6d Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 12 May 2025 19:08:16 +0900 Subject: [PATCH 5/5] minor fix --- drafts/BEP1001-app-injection.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drafts/BEP1001-app-injection.md b/drafts/BEP1001-app-injection.md index 970cd5d..3feddf2 100644 --- a/drafts/BEP1001-app-injection.md +++ b/drafts/BEP1001-app-injection.md @@ -50,8 +50,8 @@ to execute an (injected) script instead of directly writing the configuration fi **Design discussion:** - Make a wheelhouse directory and install them when first-launching the app _vs._ Make a pre-installed site-packages directory and mount subdirs into `/opt/backend.ai`? -- We must install `ipython` at least in the _target_ Python (the Python already-installed inside the container image) upon the first launch. - We also have to generate the metakernel spec (like what we does in [backend.ai-kernels](https://github.com/lablup/backend.ai-kernels/blob/075ca379c7db279f69d4485bf014750af0bb6fdc/python/Dockerfile.3.11-ubuntu22.04#L135-L137)). +- We must install `ipykernel` at least in the _target_ Python (the Python already-installed inside the container image) upon the first launch + and generate the metakernel spec (like what we does in [backend.ai-kernels](https://github.com/lablup/backend.ai-kernels/blob/075ca379c7db279f69d4485bf014750af0bb6fdc/python/Dockerfile.3.11-ubuntu22.04#L135-L137)). We need an explicit error reporting when this fails. ### VSCode