forked from TreeMaker/TreeMaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
step2.sh
executable file
·75 lines (66 loc) · 1.7 KB
/
step2.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
74
#!/bin/bash
# check for incorrect pilot cert
vomsident=$(voms-proxy-info -identity)
echo $vomsident
if [[ $vomsident = *"cmsgli"* ]]; then
# this is the exit code for "User is not authorized to write to destination site."
exit 60322
fi
export JOBNAME=""
export PROCESS=""
export OUTDIR=""
export REDIR=""
export OPTIND=1
while [[ $OPTIND -lt $# ]]; do
# getopts in silent mode, don't exit on errors
getopts ":j:p:o:x:" opt || status=$?
case "$opt" in
j) export JOBNAME=$OPTARG
;;
p) export PROCESS=$OPTARG
;;
o) export OUTDIR=$OPTARG
;;
x) export REDIR=$OPTARG
;;
# keep going if getopts had an error
\? | :) OPTIND=$((OPTIND+1))
;;
esac
done
echo "parameter set:"
echo "OUTDIR: $OUTDIR"
echo "JOBNAME: $JOBNAME"
echo "PROCESS: $PROCESS"
echo "REDIR: $REDIR"
echo ""
# link files from CMSSW dir
ln -s ${CMSSWVER}/src/TreeMaker/Production/test/data
ln -s ${CMSSWVER}/src/TreeMaker/Production/test/runMakeTreeFromMiniAOD_cfg.py
# run CMSSW
ARGS=$(cat args_${JOBNAME}_${PROCESS}.txt)
if [[ -n "$REDIR" ]]; then
ARGS="$ARGS redir=${REDIR}"
fi
THREADS=$(getFromClassAd RequestCpus)
if [[ -n "$THREADS" ]]; then
ARGS="$ARGS threads=${THREADS}"
fi
# check for incorrect pilot cert
vomsident = $(voms-proxy-info -identity)
echo $vomsident
if [[ $vomsident = *"cmsgli"* ]]; then
# this is the exit code for "User is not authorized to write to destination site."
rm *.root
echo "exit code 60322, skipping file copy"
exit 60322
fi
cp "$CMSSW_BASE/src/TreeMaker/Production/test/job_main_loop.py" .
chmod +x job_main_loop.py
./job_main_loop.py --outpath=$OUTDIR --arguments="$ARGS"
CMSSWSTATUS=$?
if [[ $CMSSWSTATUS -ne 0 ]]; then
echo "error $CMSSWSTATUS"
exit CMSSWSTATUS
fi
rm *.root