From 252e5c7d9348ff615f44c12112bc5805b267ec3c Mon Sep 17 00:00:00 2001 From: Tim Kreuzer <t.kreuzer@fz-juelich.de> Date: Mon, 4 Dec 2023 18:01:53 +0100 Subject: [PATCH] test cleanup cancel --- lmod/files/start_jupyter.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lmod/files/start_jupyter.sh b/lmod/files/start_jupyter.sh index eae0160..3cef70a 100644 --- a/lmod/files/start_jupyter.sh +++ b/lmod/files/start_jupyter.sh @@ -121,12 +121,17 @@ cleanup () { else echo "$(date) - JUST not mounted, do not unmount." fi + + # Send Cancel to JupyterHub, this way we can use restartPolicy: Always + # to "survive" VM reboots, but do not always restart properly stopped + # labs. + curl -X "POST" -d '{"failed": true, "progress": 100, "html_message": "<details><summary>Cleanup successful.</summary>Post stop hook ran successful</details>"}' ${JUPYTERHUB_EVENTS_URL} echo "$(date) - Cleanup done." } start () { echo "$(date) - Start jupyterhub-singleuser ..." - timeout $JUPYTERHUB_TIMEOUT jupyterhub-singleuser 2>${JUPYTER_LOG_DIR}/stderr 1>${JUPYTER_LOG_DIR}/stdout + timeout $JUPYTERHUB_TIMEOUT jupyterhub-singleuser 2>&1 | tee ${JUPYTER_LOG_DIR}/stdout echo "$(date) - Start jupyterhub-singleuser done" } -- GitLab