mcc10_SubmissionScript.sh
Go to the documentation of this file.
1 #! /bin/bash
2 
3 #----------------------------------------------------------------------
4 #
5 #
6 # Name: mcc10_SubmissionScript.sh
7 #
8 # Purpose: Launch batch job using project.py and different stages
9 #
10 # Usage: sh mcc10_SubmissionScript.sh --xmld <xmldir> --xml <xmlfile> --stage <stage> [--test]
11 #
12 #
13 # OPTIONS:
14 #
15 # --xml <xmlfile>
16 # --xmld <xmldir>
17 # --stage <stage>; accepted values: detsim, reco, mergeana, finalize
18 # --dataset <dataset>; NOT USED
19 # --mode <mode>; NOT USED
20 # --slice <slice>; NOT USED
21 # --test ; enable POMS test mode (1 job/10 events)
22 # --recovery <dataset>; enable POMS recovery mode NOT USED
23 #
24 # Stage "finalize" is used to declare mergeana output.
25 #
26 #----------------------------------------------------------------------
27 
28 
29 
30 overrides=""
31 
32 while :
33 do
34  case "x$1" in
35  x--|x) break;;
36  x--xmld) xmldir="$2"; shift; shift;;
37  x--xml) xmlfile="$2"; shift; shift;;
38  x--stage) stage="$2"; shift; shift;;
39  x--dataset) dataset="$2"; shift; shift;;
40  x--mode) mode="$2"; shift; shift;;
41  x--slice) slice="$2"; shift; shift;;
42  x--test) tempdir=/pnfs/dune/scratch/dunepro/mcc10_test/$(uuidgen); echo "tempdir = $tempdir" ; overrides="$overrides -Onumevents=10 -Ostage.numjobs=1 -Ostage.outdir=$tempdir -Ostage.workdir=$tempdir"; echo "overrides=$overrides"; shift;;
43  x--recovery) mode="recovery"; dataset="$2"; shift; shift;;
44  *) break;;
45  esac
46 done
47 
48 #
49 # use the New and Improved! wrap_proj...
50 #
51 wrap_proj=/grid/fermiapp/products/common/prd/poms_client/v2_0_0/NULL/bin/wrap_proj
52 
53 
54 echo -e "\nRunning\n `basename $0` $@"
55 
56 cd ${xmldir}
57 
58 if [[ $? -ne 0 ]]; then echo -e "\n dir $xmldir doesn't exist\n"; exit 1; fi
59 
60 
61 
62 if [ x"$stage" = x"detsim" ]; then
63 
64 
65  $wrap_proj $overrides project.py --xml ${xmlfile} --stage ${stage} --submit
66 
67  EXITCODE=$?
68 
69  echo "project.py terminated with exit code ${EXITCODE}"
70 
71  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
72 
73 
74 
75 
76 elif [ x"$stage" = x"reco" ]; then
77 
78 
79 
80  $wrap_proj $overrides project.py --xml ${xmlfile} --stage detsim --check
81 
82  EXITCODE=$?
83 
84  echo "project.py terminated with exit code ${EXITCODE}"
85 
86  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
87 
88 
89 
90  sleep 10
91 
92 
93 
94  $wrap_proj $overrides project.py --xml ${xmlfile} --stage ${stage} --submit
95 
96  EXITCODE=$?
97 
98  echo "project.py terminated with exit code ${EXITCODE}"
99 
100  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
101 
102 
103 
104 elif [ x"$stage" = x"mergeana" ]; then
105 
106 
107 
108  $wrap_proj $overrides project.py --xml ${xmlfile} --stage reco --check
109 
110  EXITCODE=$?
111 
112  echo "project.py terminated with exit code ${EXITCODE}"
113 
114  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
115 
116 
117 
118  sleep 10
119 
120 
121 
122  $wrap_proj $overrides project.py --xml ${xmlfile} --stage ${stage} --submit
123 
124  EXITCODE=$?
125 
126  echo "project.py terminated with exit code ${EXITCODE}"
127 
128  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
129 
130 
131 
132 elif [ x"$stage" = x"finalize" ]; then
133 
134 
135  $wrap_proj $overrides project.py --xml ${xmlfile} --stage mergeana --check
136 
137  EXITCODE=$?
138 
139  echo "project.py terminated with exit code ${EXITCODE}"
140 
141  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
142 
143 
144  sleep 10
145 
146 
147 
148  $wrap_proj $overrides project.py --xml ${xmlfile} --stage mergeana --declare
149 
150  EXITCODE=$?
151 
152  echo "project.py terminated with exit code ${EXITCODE}"
153 
154  if [ ${EXITCODE} -ne 0 ]; then exit ${EXITCODE}; fi
155 
156 
157 
158 else
159 
160  echo "stage $(stage) unknown, accepted value are: detsim, reco, mergeana, finalize"
161 
162  exit 1
163 
164 
165 
166 fi
167