]>
Commit | Line | Data |
---|---|---|
2dbde04b | 1 | #!/bin/bash |
2 | ||
3 | jobid=0 | |
4 | top=. | |
5 | verb=0 | |
6 | ||
7 | export PATH=$PATH:$ALICE_ROOT/PWG2/FORWARD/analysis2/qa:../scripts | |
8 | ||
9 | usage() | |
10 | { | |
11 | cat <<EOF | |
12 | Usage: $0 -j JOBID [OPTIONS] | |
13 | ||
14 | Options: | |
15 | -h.--help This help | |
16 | -j,--jobid JOBID Job id from MonALisa | |
17 | -o,--output DIRECTORY Where to store the result | |
18 | -v,--verbose Be verbose | |
19 | EOF | |
20 | } | |
21 | ||
22 | mess() | |
23 | { | |
24 | if test $verb -lt 1 ; then return ; fi | |
25 | echo $@ | |
26 | } | |
27 | ||
28 | # --- Get parts of the passed path ----------------------------------- | |
29 | get_parts() | |
30 | { | |
31 | y=$1 ; shift | |
32 | p=$1 ; shift | |
33 | r=$1 ; shift | |
34 | e=$1 ; shift | |
35 | x=$1 ; shift | |
36 | r=$1 | |
37 | ||
38 | P=`echo $x | sed 's/.*pass\([0-9]*\).*/\1/'` | |
39 | R=`echo $x | sed -n "s/.*pass${P}_//p"` | |
40 | Q=`echo $x | sed -n 's/pass.*//p'` | |
41 | ||
42 | case x$r in | |
43 | xQA*) q=`echo $r | sed 's/QA//'` ;; | |
44 | x) ;; | |
45 | *) ;; | |
46 | esac | |
47 | ||
48 | opts="-p $p -P $P" | |
49 | if test "x$R" != "x" ; then opts="$opts -R $R" ; fi | |
50 | if test "x$q" != "x" ; then opts="$opts -q $q" ; fi | |
51 | if test "x$Q" != "x" ; then opts="$opts -Q $Q" ; fi | |
52 | ||
53 | dest="${p}/${Q}pass${P}" | |
54 | if test "x$R" != "x" ; then dest="${dest}_${R}" ; fi | |
55 | ||
56 | } | |
57 | ||
58 | # --- Get the options ------------------------------------------------ | |
59 | get_opts() { | |
60 | wget -q http://alimonitor.cern.ch/prod/jobs.jsp?t=${jobid} -O job.html | |
61 | p=`grep "/catalogue/index.jsp?path" job.html | head -n 1 | sed -e 's,.*/alice/data/\([^<]*\)<.*,\1,' | tr '/' ' '` | |
62 | get_parts $p | |
63 | } | |
64 | ||
65 | # --- comamnd line --------------------------------------------------- | |
66 | while test $# -gt 0 ; do | |
67 | case $1 in | |
68 | -h|--help) usage ; exit 0 ;; | |
69 | -j|--jobid) jobid=$2; shift ;; | |
70 | -o|--output) top=$2 ; shift ;; | |
71 | -v|--verbose) verb=1 ;; | |
72 | *) echo "Unknown option $1" > /dev/stderr ; exit 1 ;; | |
73 | esac | |
74 | shift | |
75 | done | |
76 | ||
77 | # --- Sanity --------------------------------------------------------- | |
78 | if test $jobid -lt 1 ; then | |
79 | echo "No JOBID specified" > /dev/stderr | |
80 | exit 1 | |
81 | fi | |
82 | ||
83 | # --- Extract options ------------------------------------------------ | |
84 | get_opts $jobid | |
85 | mess "Options for getQAresults: $opts, destingation: $dest" | |
86 | if test "x$opts" = "x" ; then | |
87 | echo "No options found" | |
88 | exit 1 | |
89 | fi | |
90 | ||
91 | set -e | |
92 | ||
93 | # --- Download the files --------------------------------------------- | |
94 | mess "Running getQAResults.sh $opts -d $top -n " | |
95 | getQAResults.sh $opts -d $top -T -v -v | |
96 | ||
97 | # --- Now run the QA code ------------------------------------------- | |
98 | savdir=`pwd` | |
99 | cd $top/${dest} | |
100 | root -l -b -q $ALICE_ROOT/PWG2/FORWARD/analysis2/qa/RunQA.C | |
101 | cd $savdir | |
102 | ||
103 | cat <<EOF | |
104 | ||
105 | Finished running QA for jobid $jobid. | |
106 | Output is stored in $top/${dest} | |
107 | EOF | |
108 | ||
109 | # | |
110 | # EOF | |
111 | # | |
112 | ||
113 | ||
114 | ||
115 |