source: trunk/DataCheck/Processing/RunCallisto.sh@ 19879

Last change on this file since 19879 was 18765, checked in by Daniela Dorner, 8 years ago
addapted to new way of submitting jobs in JobManager
  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/bash
2#
3
4source `dirname $0`/../Sourcefile.sh
5printprocesslog "INFO starting $0"
6program=RunCallisto
7step=Callisto
8
9set -C
10
11# get night and seqid
12if [ "$night" = "" ] && [ "$seqid" = "" ]
13then
14 # if no number are provided by JobManager
15 for (( i=0; i<100; i++ ))
16 do
17 # avoid too many simultaneous queries
18 sleep $(( ( RANDOM % 10 ) + 1 ))
19 # get todo list
20 gettodo "1"
21 echo ${primaries[@]}
22
23 # get all needed variables
24 night=${primaries[0]}
25 seqid=${primaries[1]}
26 nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
27 seqnum=$night"_"`printf %03d $seqid`
28
29 # check if script is already running
30 lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
31 checklock continue
32 printprocesslog "INFO got todo with try #"$i
33 break
34 done
35else
36 nightpath=`echo $night | cut -c 1-4`"/"`echo $night | cut -c 5-6`"/"`echo $night | cut -c 7-8`
37 seqnum=$night"_"`printf %03d $seqid`
38 # check if script is already running
39 lockfile=$lockpath"/lock-"$program"-"$seqnum".txt"
40 checklock
41 s=0
42 primaries=( $night $seqid )
43fi
44
45# get all needed paths and files
46delays="resources/delays-20150217.txt"
47drstimefiles=`ls $drstimepath | sort`
48for drstimefile in $drstimefiles
49do
50 num=`echo $drstimefile | cut -c 1-8`
51 if [ $num -gt $night ]
52 then
53 break
54 fi
55 drstime=$drstimepath/$drstimefile
56done
57
58seqfile=$seqpath"/"$nightpath"/"$seqnum".seq"
59outpath=$datapath"/callisto/"$nightpath
60makedir $outpath
61logfile=$outpath"/"$seqnum"-calibration.log"
62
63cd $mars
64
65# set status in DB
66# maybe already done in JobManager
67# but do it again to have real runtime
68setstatus "start"
69
70# run callisto
71printprocesslog "INFO starting callisto.C for sequence "$seqnum
72
73printprocesslog "DEBUG root -q -b fact/analysis/callisto.C\("\"$seqfile\""\,"\"$outpath\""\,\""$drstime"\"\,\""$delays"\"\) | tee $logfile "
74check1=`root -q -b fact/analysis/callisto.C\("\"$seqfile\""\,"\"$outpath\""\,\""$drstime"\"\,\""$delays"\"\) | tee $logfile | intgrep`
75
76case $check1 in
77 0) printprocesslog "INFO callisto was successful for sequence "$seqnum" (check1=$check1)"
78 ;;
79 *) printprocesslog "ERROR callisto.C failed for sequence "$seqnum" (check1=$check1)"
80 check=$check1
81 ;;
82esac
83
84setstatus "stop"
85
86finish
87
Note: See TracBrowser for help on using the repository browser.