3 # --- Usage ----------------------------------------------------------
10 -p,--production PERIOD LHC Period identifier [$prod]
11 -P,--pass PASS Production pass identifier [$prodpass]
12 -n,--part PART Part identifier [$part]
13 -r,--runs RUNS List of runs or file [$runs]
14 -c,--clean Clean previous job output [$clean]
15 -v,--verbose Increase verbosity [$verb]
20 # --- Check AliEn token ----------------------------------------------
24 genv_file=/tmp/gclient_env_${uid}
26 if test ! -f ${genv_file} ; then
27 echo "No such file: ${genv_file}, please do alien-token-init" \
32 alien-token-info | grep -q "Token is still valid"
33 if test $? -ne 0 ; then
34 echo "Token not valid, please re-new" > /dev/stderr
39 # --- Diagnostics output ---------------------------------------------
43 if test $1 -gt $verb ; then return ; fi
48 # --- Parse production information -----------------------------------
51 prodyear=`echo $prodfull | sed 's/LHC\(..\).*/\1/'`
52 prodletter=`echo $prodfull | sed "s/LHC${prodyear}\(.\).*/\1/"`
53 prodpost=`echo $prodfull | sed "s/LHC${prodyear}${prodletter}//"`
58 passno=`echo $passfull | sed 's/.*pass\([0-9]*\).*/\1/'`
59 passpost=`echo $passfull | sed -n "s/.*pass${passno}_//p"`
60 passpre=`echo $passfull | sed -n "s/pass.*//p"`
63 # --- Append path element --------------------------------------------
68 if test "x$tmp" != "x" ; then tmp="${tmp}/" ; fi
72 # --- Get the path and search pattern --------------------------------
82 *) mess 3 "Assuming simulation output"
89 if echo "$passno" | grep -q -E '^[0-9]*[.]?[0-9]*$' ; then
90 if test "x$passfull" != "x" && test $passno -gt 0 ; then
98 local post=${passpost}
102 *) post="_${post}" ;;
105 # Assume official productions
106 path=/alice/${datd}/${year}/${prodfull}/
107 search="${esdd}${passpre}${paid}${post}"
108 search=`append_to_path "$search" "*/AliESDs.root"`
111 # --- Setup the runs -------------------------------------------------
115 if test -f $runs ; then
116 unique=`basename $runs .txt`
117 unique=`basename $unique .list`
118 unique=`basename $unique .runs`
121 local l=`echo "$runs" | tr ',+:.' ' '`
125 if test "x$first" = "x" ; then first=$i ; fi
128 unique=${first}_${last}
129 runs=`echo "$l" | tr ' ' ','`
132 # --- Clean previous attempt -----------------------------------------
135 local alienu=`alien_whoami | tr -d ' '`
136 local alienl=`echo ${alienu} | cut -c1`
137 local aliend="/alice/cern.ch/user/${alienl}/${alienu}/${name}"
138 mess 1 "Removing local directory ${name}"
139 if test $noact -lt 1 ; then rm -rf ${name} ; fi
140 mess 1 "Removing alien directory ${aliend}"
141 if test $noact -lt 1 ; then alien_rmdir ${aliend} ; fi
144 # --- Parse command line options -------------------------------------
149 while test $# -gt 0 ; do
151 -h|--help) usage ; exit 0 ;;
152 -v|--verbose) let verb=$verb+1 ;;
153 -l|--log-file) redir= ;;
154 -p|--production) prodfull=$2; shift; parse_prod ; year=20${prodyear} ;;
155 -P|--pass) passfull=$2; shift; parse_pass ;;
156 -n|--part) part=$2 ; shift ;;
157 -r|--runs) runs=$2 ; shift ;;
158 -c|--clean) clean=1 ; shift ;;
159 -s|--noact) noact=1 ; shift ;;
160 *) echo "$0: Unknown argument: $1" > /dev/stderr ; exit 1 ;;
165 # --- Initial checks -------------------------------------------------
166 if test "x$prodfull" = "x" ; then
167 echo "No production specified" > /dev/stderr
170 if test "x$passfull" = "x" ; then
171 echo "No pass specified" > /dev/stderr
174 if test "x$runs" = "x" ; then
175 echo "No runs specified" > /dev/stderr
182 name="QA_${prodfull}_${passfull}"
183 if test "x$part" != "x" ; then
184 if echo "$part" | grep -q -E '^[0-9]*[.]?[0-9]*$' ; then
187 name="${name}_${part}"
190 if test $clean -gt 0 ; then clean_previous ; fi
193 # --- Some friendly information --------------------------------------
196 Production: ${prodfull}
198 Letter: ${prodletter}
213 # --- Do the actual running ------------------------------------------
214 url="alien:///alice/data/${year}/${prodfull}\?run=${runs}\&pattern=${search}&ttl=18000&split=100&merge=50#esdTree"
216 opts=(--class=${train} \
220 mess 1 "Will do runTrain \"${opts[@]}\" $@"
221 if test $noact -gt 0 ; then
224 runTrain "${opts[@]}" $@
227 mess 1 "Will monitor in directory $name"
228 if test $noact -gt 0 ; then
231 (cd ${name} && aliroot -b -x -q -l Watch.C)