From 8b0365fb6e6ece9f32c0277ed976c0ffa8c4bec9 Mon Sep 17 00:00:00 2001 From: Walter Lampl <Walter.Lampl@cern.ch> Date: Mon, 18 May 2020 10:44:18 +0200 Subject: [PATCH] cherry-pick ThinCAWrapper from WIP MR 27212 --- Control/AthenaCommon/share/ThinCAWrapper.sh | 43 +++++++++++++++++++++ Control/AthenaCommon/share/athena.py | 11 +++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100755 Control/AthenaCommon/share/ThinCAWrapper.sh diff --git a/Control/AthenaCommon/share/ThinCAWrapper.sh b/Control/AthenaCommon/share/ThinCAWrapper.sh new file mode 100755 index 00000000000..10d4ee14c69 --- /dev/null +++ b/Control/AthenaCommon/share/ThinCAWrapper.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# Demonstator for a thin wrapper to execute configurations with the CA +# + +topScriptSearchPath="." + +if [ ! -z "${WorkDir_DIR}" ] + then + topScriptSearchPath="$topScriptSearchPath $WorkDir_DIR_DIR/python" +fi + +if [ ! -z "${Athena_DIR}" ] + then + topScriptSearchPath="$topScriptSearchPath $Athena_DIR/python" +fi + +topscriptfile=`echo $otherargs | cut -d " " -f 1` +scriptargs=`echo $otherargs | cut -d " " -f 2-` + + +for pp in $topScriptSearchPath +do + if [ -f "$pp/$topscriptfile" ] + then + topscript="$pp/$topscriptfile" + break + fi +done + + +if [[ -z $topscript ]]; + then + echo "Could not find python script $topscriptfile" + exit 1 +fi + +python $topscript $scriptargs + + + diff --git a/Control/AthenaCommon/share/athena.py b/Control/AthenaCommon/share/athena.py index 1cc99b8102a..4efe84d8b74 100755 --- a/Control/AthenaCommon/share/athena.py +++ b/Control/AthenaCommon/share/athena.py @@ -9,7 +9,8 @@ # defaults export USETCMALLOC=0 export USEIMF=0 - +USECA=0 +otherargs="" # but use tcmalloc by default if TCMALLOCDIR is defined if [ -n "$TCMALLOCDIR" ]; then export USETCMALLOC=1 @@ -27,12 +28,20 @@ do --imf) USEIMF=1;; --preloadlib*) export ATHENA_ADD_PRELOAD=${a#*=};; --drop-and-reload) export ATHENA_DROP_RELOAD=1;; + --CA) USECA=1;; + *) otherargs="$otherargs $a";; esac done # Do the actual preloading via LD_PRELOAD source `which athena_preload.sh ` +if [ $USECA -eq 1 ] +then + source `which ThinCAWrapper.sh` + exit 0 +fi + # Now resurrect ourselves as python script python_path=`which python` "exec" "$python_path" "-tt" "$0" "$@"; -- GitLab