From bdc87e0b8a9a15af393c9ba271ab6fb7318e37bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Mon, 7 Aug 2023 21:37:18 +0200 Subject: [PATCH] fix: improve error handling logic (#35) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: improve error handling logic * remove test du --------- Co-authored-by: Felix Mölder --- entrypoint.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f2e433f..668ad36 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,20 +8,17 @@ eval "$4" # create container file if [ "$5" = 'containerize' ] ; then snakemake --directory $1 --snakefile $2 --show-failed-logs $3 --containerize > Dockerfile - # return disk space usage on failing - if [[ "$?" -ne 0 && "$6" = true ]] ; then - du -h -d3 $1 && exit 1 - fi elif [ "$5" = 'run' ] ; then # run snakemake with given args snakemake --directory $1 --snakefile $2 --show-failed-logs $3 - # return disk space usage on failing - if [[ "$?" -ne 0 && "$6" = true ]] ; then - df -h - echo "du home\n" - du -h -d3 /github/home - echo "du working directory\n" - du -h -d3 $1 && exit 1 + if [[ "$?" -ne 0 ]]; then + if [[ "$6" = true ]]; then + # return disk usage and space on failing + df -h + printf "disk usage working directory" + du -h -d3 $1 + fi + exit 1 fi else echo "Task input not recognized." && exit 1