-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathcrab
More file actions
executable file
·30 lines (24 loc) · 1.23 KB
/
crab
File metadata and controls
executable file
·30 lines (24 loc) · 1.23 KB
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
#!/bin/bash
script_dir=`dirname $0`
python_cmd="python"
[ -z "$CMSSW_VERSION" ] && echo "CMSSW is missing. You must do cmsenv first" && exit
CMSSW_Major=$(echo $CMSSW_VERSION | cut -d_ -f2) # e.g. from CMSSW_13_1_x this is "13"
CMSSW_Serie=$(echo $CMSSW_VERSION | cut -d_ -f3) # e.g. from CMSSW_10_6_x this is "6"
# CRABClient can use python3 starting from CMSSW_10_2
[ $CMSSW_Major -gt 10 ] && python_cmd="python3"
[ $CMSSW_Major -eq 10 ] && [ $CMSSW_Serie -ge 2 ] && python_cmd="python3"
# but for crab submit, need to stick with same python as cmsRun, to allow
# proper processing of config files and proper PSet.pkl
[ $CMSSW_Major -lt 12 ] && [ X$1 == Xsubmit ] && python_cmd="python"
if [ $python_cmd = "python3" ] ; then
# can also include Rucio client (we do not want to deal with old python2 client)
RUCIO_ENV=`${script_dir}/rucio_env.sh`
export RUCIO_HOME=`echo $RUCIO_ENV|cut -d' ' -f1`
RUCIO_PYTHONPATH=`echo $RUCIO_ENV|cut -d' ' -f2`
# alter PYTHONPATH here to keep flexibility to add or append as we find better
export PYTHONPATH=$RUCIO_PYTHONPATH:$PYTHONPATH
fi
# avoid pythonpath contamination by user .local files
export PYTHONNOUSERSITE=true
# finally run crab client
exec ${python_cmd} ${script_dir}/crab.py ${1+"$@"}