|
|
|
@ -88,13 +88,24 @@ echo " * launching jupyter notebook server" |
|
|
|
|
(srun -n 1 -c 2 -J juypter "${SLURM_ARGS[@]}" jupyter-notebook --no-browser --port=$((8000 + $RANDOM % 1000)) --ip=0.0.0.0 2>&1 | tee $jupyter_output > /dev/null) & |
|
|
|
|
|
|
|
|
|
echo " * waiting for Jupyter server to be ready ..." |
|
|
|
|
for ((i=0; i < 90; ++i)); do |
|
|
|
|
for ((i=0; i < 120; ++i)); do |
|
|
|
|
tokens=$(awk -F: '/ http:/ {print $3}' $jupyter_output) |
|
|
|
|
if [ -n "$tokens" ]; then |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
sleep 1s |
|
|
|
|
done |
|
|
|
|
if [ -z "$tokens" ]; then |
|
|
|
|
echo "Error: Cannot find the Jupyter server URL!" |
|
|
|
|
echo |
|
|
|
|
echo "Dump of Jupyter process output:" |
|
|
|
|
echo "-------------------------------" |
|
|
|
|
cat $jupyter_output |
|
|
|
|
echo |
|
|
|
|
echo "Exiting due to error..." |
|
|
|
|
exit 2 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Don't use echo to avoid divulging the token (!!) |
|
|
|
|
port=${tokens%/*} |
|
|
|
|
token=${tokens#*token=} |
|
|
|
|