Skip to content

Commit 1fba96d

Browse files
committed
added max retries, removed startsecs, moved stderr to stderr
1 parent 35f17c9 commit 1fba96d

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

template/start-code-interpreter.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#!/bin/bash
22

33
echo "Waiting for Jupyter server to be ready..."
4+
retries=0
5+
max_retries=20
46
until curl -s -o /dev/null -w '%{http_code}' http://localhost:8888/api/status | grep -q '200'; do
7+
retries=$((retries + 1))
8+
if [ "$retries" -ge "$max_retries" ]; then
9+
echo "Jupyter server failed to start after $max_retries retries"
10+
exit 1
11+
fi
512
sleep 0.5
613
done
714
echo "Jupyter server is ready, starting Code Interpreter..."

template/supervisord.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pidfile=/var/run/supervisord.pid
77
command=/root/.jupyter/start-jupyter.sh
88
environment=MATPLOTLIBRC="/root/.config/matplotlib/.matplotlibrc"
99
stdout_logfile=/dev/null
10-
stderr_logfile=/dev/fd/1
10+
stderr_logfile=/dev/fd/2
1111
stderr_logfile_maxbytes=0
1212
autorestart=true
1313
stopasgroup=true
@@ -19,10 +19,9 @@ command=/root/.jupyter/start-code-interpreter.sh
1919
directory=/root/.server
2020
stdout_logfile=/dev/fd/1
2121
stdout_logfile_maxbytes=0
22-
stderr_logfile=/dev/fd/1
22+
stderr_logfile=/dev/fd/2
2323
stderr_logfile_maxbytes=0
2424
autorestart=true
2525
stopasgroup=true
2626
killasgroup=true
2727
priority=20
28-
startsecs=0

0 commit comments

Comments
 (0)