Skip to content

Commit 615ae5c

Browse files
committed
Adjustments to make module swapping work in our singularity container
1 parent 7340626 commit 615ae5c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

MC/run/ANCHOR/anchorMC.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ NWORKERS=${NWORKERS:-8}
146146
SEED=${ALIEN_PROC_ID:-${SEED:-1}}
147147

148148
ONCVMFS=0
149+
150+
if ! declare -F module > /dev/null; then
151+
module() {
152+
eval "$(/usr/bin/modulecmd bash "$@")";
153+
}
154+
export -f module
155+
fi
156+
149157
[[ "${BASEDIR}" == /cvmfs/* ]] && ONCVMFS=1
150158
if [ ! "${MODULEPATH}" ]; then
151159
export MODULEPATH=${BASEDIR}/../Modules/modulefiles
@@ -159,12 +167,18 @@ fi
159167
#<----- START OF part that should run under a clean alternative software environment if this was given ------
160168
if [ "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" ]; then
161169
if [ "${LOADEDMODULES}" ]; then
170+
echo "Stashing initial modules"
162171
module save initial_modules.list # we stash the current modules environment
163-
module purge
172+
module list --no-pager
173+
module purge --no-pager
174+
export > env_after_stashing.env
175+
echo "Modules after purge"
176+
module list --no-pager
164177
fi
165178
echo_info "Using tag ${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG} to setup anchored MC"
166179
/cvmfs/alice.cern.ch/bin/alienv printenv "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" &> async_environment.env
167180
source async_environment.env
181+
export > env_async.env
168182
fi
169183

170184
# default async_pass.sh script
@@ -230,7 +244,7 @@ fi
230244

231245
# get rid of the temporary software environment
232246
if [ "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" ]; then
233-
module purge
247+
module purge --no-pager
234248
# restore the initial software environment
235249
echo "Restoring initial environment"
236250
module --no-pager restore initial_modules.list

0 commit comments

Comments
 (0)