-
Notifications
You must be signed in to change notification settings - Fork 206
Added supervisord to survive process restart #219
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
Changes from 7 commits
82a9992
c36ff29
1914c4a
3910e65
12dc7f4
27ae39d
f86f1ca
730f76a
b2144d3
535057c
ced28e2
dd60d00
b9eedf0
2e145cc
a31d702
443c546
35f17c9
1fba96d
648e8f5
6de643e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "Waiting for Jupyter server to be ready..." | ||
| until curl -s -o /dev/null -w '%{http_code}' http://localhost:8888/api/status | grep -q '200'; do | ||
| sleep 0.5 | ||
| done | ||
| echo "Jupyter server is ready, starting Code Interpreter..." | ||
|
|
||
| exec /root/.server/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 49999 --workers 1 --no-access-log --no-use-colors --timeout-keep-alive 640 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| trap 'echo "Jupyter exited, killing code-interpreter..."; pkill -f "uvicorn main:app"' EXIT | ||
|
|
||
| exec /usr/local/bin/jupyter server --IdentityProvider.token="" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,4 @@ | ||
| #!/bin/bash | ||
|
|
||
| function start_jupyter_server() { | ||
| counter=0 | ||
| response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:8888/api/status") | ||
| while [[ ${response} -ne 200 ]]; do | ||
| let counter++ | ||
| if ((counter % 20 == 0)); then | ||
| echo "Waiting for Jupyter Server to start..." | ||
| sleep 0.1 | ||
| fi | ||
|
|
||
| response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:8888/api/status") | ||
| done | ||
|
|
||
| cd /root/.server/ | ||
| .venv/bin/uvicorn main:app --host 0.0.0.0 --port 49999 --workers 1 --no-access-log --no-use-colors --timeout-keep-alive 640 | ||
| } | ||
|
|
||
| echo "Starting Code Interpreter server..." | ||
| start_jupyter_server & | ||
| MATPLOTLIBRC=/root/.config/matplotlib/.matplotlibrc jupyter server --IdentityProvider.token="" >/dev/null 2>&1 | ||
| supervisord -c /etc/supervisord.conf | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we could do this as a start command, so it's obvious?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the reason I left it there is so you can track the changes to the command in git history |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [supervisord] | ||
| nodaemon=true | ||
| logfile=/var/log/supervisord.log | ||
| pidfile=/var/run/supervisord.pid | ||
|
|
||
| [program:jupyter] | ||
mishushakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| command=/root/.jupyter/start-jupyter.sh | ||
| environment=MATPLOTLIBRC="/root/.config/matplotlib/.matplotlibrc" | ||
| stdout_logfile=/dev/null | ||
| stderr_logfile=/dev/fd/1 | ||
| stderr_logfile_maxbytes=0 | ||
| autorestart=true | ||
mishushakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| priority=10 | ||
mishushakov marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
|
||
|
|
||
| [program:code-interpreter] | ||
| command=/root/.jupyter/start-code-interpreter.sh | ||
| directory=/root/.server | ||
| stdout_logfile=/dev/fd/1 | ||
| stdout_logfile_maxbytes=0 | ||
| stderr_logfile=/dev/fd/1 | ||
mishushakov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| stderr_logfile_maxbytes=0 | ||
| autorestart=true | ||
| priority=20 | ||
| startsecs=0 | ||
mishushakov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||


Uh oh!
There was an error while loading. Please reload this page.