-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_environment_remote.sh
73 lines (62 loc) · 2.24 KB
/
setup_environment_remote.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
function xrdcp_with_check {
if [ "${#}" != 2 ]; then
echo "ERROR: number of arguments passed to \"${FUNCNAME}\": ${#}"
exit 1
fi
xrdcp --silent --nopbar --force --path --streams 15 ${1} ${2} 2>&1
XRDEXIT=${?}
if [[ ${XRDEXIT} -ne 0 ]]; then
echo "exit code ${XRDEXIT}, failure in xrdcp"
exit ${XRDEXIT}
fi
}
function xrdmv_with_check {
if [ "${#}" != 2 ]; then
echo "ERROR: number of arguments passed to \"${FUNCNAME}\": ${#}"
exit 1
fi
xrdcp_with_check "${1}" "${2}"
rm ${1}
}
function cleanup {
cd ${_CONDOR_SCRATCH_DIR}
rm -r -f proxy
rm -r -f tmPyUtils
rm -r -f tmCPPUtils
rm -r -f CMSSW_10_2_10
}
cd ${_CONDOR_SCRATCH_DIR}
# Make sure there's exactly one file beginning with "x509"
x509Matches=`find . -maxdepth 2 -type f -name x509*`
NMatchesMinusOne=`echo ${x509Matches} | tr -cd " \t" | wc -c`
if [ "${NMatchesMinusOne}" != "0" ]; then
echo "ERROR: More than one file found beginning with x509"
exit 1
fi
# Move file to proxy
mkdir proxy
mv -v x509* proxy/
x509Matches=`find proxy/ -maxdepth 2 -type f -name x509*`
export X509_USER_PROXY=${_CONDOR_SCRATCH_DIR}/${x509Matches}
echo "Set X509_USER_PROXY=${X509_USER_PROXY}"
echo "voms output:"
voms-proxy-info --all
cd ${_CONDOR_SCRATCH_DIR}
echo "Starting job on: `date`" #Date/time of start of job
echo "Running on: `uname -a`" #Condor job is running on this node
echo "System software: `cat /etc/redhat-release`" #Operating System on that node
# Source CMSSW environment
echo "Sourcing CMSSW environment..."
source /cvmfs/cms.cern.ch/cmsset_default.sh
export SCRAM_ARCH=slc6_amd64_gcc700
xrdcp --silent --nopbar --force --path --streams 15 root://cmseos.fnal.gov//store/user/lpcsusystealth/combineToolCMSSW/CMSSW10210.tar.gz .
tar -xzf CMSSW10210.tar.gz && rm CMSSW10210.tar.gz
cd CMSSW_10_2_10/src/ && scramv1 b ProjectRename && eval `scramv1 runtime -sh` && cd ../..
echo "CMSSW version: ${CMSSW_BASE}"
echo "Extracting tmUtils tarball..."
./extract_tmUtilsTarball.sh && rm -f tmUtils.tar.gz
echo "Setting env variables..."
export PYTHONPATH=${_CONDOR_SCRATCH_DIR}/tmPyUtils:${PYTHONPATH}
export TMPYUTILS=${_CONDOR_SCRATCH_DIR}/tmPyUtils/
export TMCPPUTILS=${_CONDOR_SCRATCH_DIR}/tmCPPUtils/