Skip to content

Deno workarounds #73

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion template/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
25 changes: 18 additions & 7 deletions template/start-up.sh
Original file line number Diff line number Diff line change
@@ -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}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious: why are deleting the session here but not for the python kernel?


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
2 changes: 1 addition & 1 deletion template/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this solves the import problem correct?

RUN chmod +x /usr/bin/deno
RUN deno jupyter --unstable --install
COPY ./template/deno.json /root/.local/share/jupyter/kernels/deno/kernel.json