From fbdff012ae0e3de6958a6aac1cae92487131c8c1 Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Wed, 12 Jan 2022 14:53:28 +0100 Subject: [PATCH] Add debug utils (#705) --- .dockerignore | 1 - Dockerfile | 3 +++ scripts/install-debug.sh | 8 ++++++++ scripts/stacktrace.sh | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 scripts/install-debug.sh create mode 100755 scripts/stacktrace.sh diff --git a/.dockerignore b/.dockerignore index c472ef0908..0483b48447 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,6 @@ .github venv tests -scripts examples webapp/node_modules diff --git a/Dockerfile b/Dockerfile index 9887257a40..844ab98fe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,10 @@ RUN ln -s /antares-launcher/antareslauncher /antareslauncher RUN mkdir /conf/antares-launcher RUN cp /antares-launcher/requirements.txt /conf/antares-launcher/requirements.txt +RUN ./scripts/install-debug.sh + RUN pip3 install --upgrade pip \ && pip3 install -r /conf/requirements.txt + ENTRYPOINT ./scripts/start.sh diff --git a/scripts/install-debug.sh b/scripts/install-debug.sh new file mode 100755 index 0000000000..2ada4a30c4 --- /dev/null +++ b/scripts/install-debug.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +python3 -m venv /debug_env +source /debug_env/bin/activate +pip3 install pystack-debugger +deactivate \ No newline at end of file diff --git a/scripts/stacktrace.sh b/scripts/stacktrace.sh new file mode 100755 index 0000000000..4ce721ad78 --- /dev/null +++ b/scripts/stacktrace.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +source /debug_env/bin/activate +echo "Printing stacktraces" +ps aux | grep python | awk '{print $2}' | xargs -I{} bash -c "echo {}; pystack --include-greenlet {}" +echo "Done" \ No newline at end of file