From d88368bf1b7b73521bce59c0a329159abca792ac Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Tue, 25 Mar 2025 16:54:38 +0100 Subject: [PATCH 1/2] updated deno version --- template/Dockerfile | 2 +- template/test.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template/Dockerfile b/template/Dockerfile index b023150..fb0f5bd 100644 --- a/template/Dockerfile +++ b/template/Dockerfile @@ -29,7 +29,7 @@ RUN npm install -g --unsafe-perm ijavascript RUN ijsinstall --install=global # Deno Kernel -COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno +COPY --from=denoland/deno:bin-2.2.5 /deno /usr/bin/deno RUN chmod +x /usr/bin/deno RUN deno jupyter --unstable --install COPY ./deno.json /root/.local/share/jupyter/kernels/deno/kernel.json diff --git a/template/test.Dockerfile b/template/test.Dockerfile index f364791..6ce1014 100644 --- a/template/test.Dockerfile +++ b/template/test.Dockerfile @@ -24,7 +24,7 @@ RUN npm install -g --unsafe-perm ijavascript RUN ijsinstall --install=global # Deno Kernel -COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno +COPY --from=denoland/deno:bin-2.2.5 /deno /usr/bin/deno RUN chmod +x /usr/bin/deno RUN deno jupyter --unstable --install COPY ./template/deno.json /root/.local/share/jupyter/kernels/deno/kernel.json From 77d7a8f06c83d8395685b7011b09b34f86617a42 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:51:13 +0100 Subject: [PATCH 2/2] added Deno warmup script --- template/start-up.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/template/start-up.sh b/template/start-up.sh index fb45f47..c458b01 100644 --- a/template/start-up.sh +++ b/template/start-up.sh @@ -13,17 +13,28 @@ function start_jupyter_server() { response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:8888/api/status") done - response=$(curl -s -X POST "localhost:8888/api/sessions" -H "Content-Type: application/json" -d '{"path": "/home/user", "kernel": {"name": "python3"}, "type": "notebook", "name": "default"}') - status=$(echo "${response}" | jq -r '.kernel.execution_state') - if [[ ${status} != "starting" ]]; then - echo "Error creating kernel: ${response} ${status}" + python_response=$(curl -s -X POST "localhost:8888/api/sessions" -H "Content-Type: application/json" -d '{"path": "/home/user", "kernel": {"name": "python3"}, "type": "notebook", "name": "default"}') + python_status=$(echo "${python_response}" | jq -r '.kernel.execution_state') + if [[ ${python_status} != "starting" ]]; then + echo "Error creating kernel: ${python_response} ${python_status}" exit 1 fi sudo mkdir -p /root/.jupyter - kernel_id=$(echo "${response}" | jq -r '.kernel.id') - sudo echo "${kernel_id}" | sudo tee /root/.jupyter/kernel_id >/dev/null - sudo echo "${response}" | sudo tee /root/.jupyter/.session_info >/dev/null + python_kernel_id=$(echo "${python_response}" | jq -r '.kernel.id') + sudo echo "${python_kernel_id}" | sudo tee /root/.jupyter/kernel_id >/dev/null + sudo echo "${python_response}" | sudo tee /root/.jupyter/.session_info >/dev/null + + # Warm up the Deno kernel + deno_response=$(curl -s -X POST "localhost:8888/api/sessions" -H "Content-Type: application/json" -d '{"path": "/home/user/deno", "kernel": {"name": "deno"}, "type": "notebook", "name": "default"}') + deno_status=$(echo "${deno_response}" | jq -r '.kernel.execution_state') + if [[ ${deno_status} != "starting" ]]; then + echo "Error creating kernel: ${deno_response} ${deno_status}" + exit 1 + fi + + deno_session_id=$(echo "${deno_response}" | jq -r '.id') + curl -s -X DELETE "localhost:8888/api/sessions/${deno_session_id}" cd /root/.server/ /root/.server/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 49999 --workers 1 --no-access-log --no-use-colors