ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/workflow/scripts/wait_hmi.lev1_FSN.csh
Revision: 1.4
Committed: Tue Feb 1 02:24:16 2011 UTC (12 years, 7 months ago) by phil
Content type: application/x-csh
Branch: MAIN
CVS Tags: Ver_6-0, Ver_6-1, Ver_6-2, Ver_6-3, Ver_6-4, Ver_9-1, Ver_5-14, Ver_5-13, Ver_LATEST, Ver_9-3, Ver_9-41, Ver_9-2, Ver_8-8, Ver_8-2, Ver_8-3, Ver_8-0, Ver_8-1, Ver_8-6, Ver_8-7, Ver_8-4, Ver_8-5, Ver_7-1, Ver_7-0, Ver_9-5, Ver_9-4, Ver_8-10, Ver_8-11, Ver_8-12, Ver_9-0, HEAD
Changes since 1.3: +1 -1 lines
Log Message:
Add #! /bin/csh -f to all scripts

File Contents

# Content
1 #! /bin/csh -f
2 # Script to wait for HMI lev1 data to be filled in
3 #
4 # this is run in the task instance directory where there is a 'ticket' file that specifies
5 # the request.
6
7 # XXXXXXXXXX test
8 # set echo
9 # XXXXXXXXXX test
10
11 set HERE = $cwd
12 set LOG = $HERE/runlog
13 set BABBLE = $HERE/babble
14
15 date > $LOG
16
17 # Check end of hmi.lev1 for coverage, wait if needed.
18 # the files containing wantlow and wanthigh are in the current dir when this is called.
19
20 # first wait until hmi.lev1 at least includes wanthigh
21 set wantlow = `cat wantlow`
22 set wanthigh = `cat wanthigh`
23 echo "wanthigh = " $wanthigh >> $LOG
24 echo "wantlow = " $wantlow >> $LOG
25
26 set wanthigh_t = `time_convert time=$wanthigh`
27 set lev1end = `show_info key=T_OBS -q hmi.lev1'[$]'`
28 set lev1end_t = `time_convert time=$lev1end`
29 while ($lev1end_t < $wanthigh_t)
30 echo -n '.' >>$BABBLE
31 sleep 300
32 set lev1end = `show_info key=T_OBS -q hmi.lev1'[$]'`
33 set lev1end_t = `time_convert time=$lev1end`
34 end
35
36 # now find the first and last FSN for the wanted range. Must use lev0 since may be gaps in lev1
37 set wantlow_t = `time_convert time=$wantlow`
38 @ wantlow_t = $wantlow_t - 5
39 @ wanthigh_t = $wanthigh_t + 5
40 set First_FSN = `show_info -q key=FSN hmi.lev0a'[? T_OBS>'$wantlow_t' AND T_OBS<'$wanthigh_t' ?]' n=1`
41 set Last_FSN = `show_info -q key=FSN hmi.lev0a'[? T_OBS>'$wantlow_t' AND T_OBS<'$wanthigh_t' ?]' n=-1`
42 echo "First_FSN = " $First_FSN >> $LOG
43 echo "Last_FSN = " $Last_FSN >> $LOG
44
45 # Wait until all FSN in the range are accounted for
46 # Note - this test is for FSN not for times.
47 @ n_expect = 1 + $Last_FSN - $First_FSN
48 set n_have = `show_info -cq hmi.lev1'[]['$First_FSN'-'$Last_FSN']'`
49 set n_tries = 0
50 while ($n_have < $n_expect)
51 sleep 600
52 echo -n '.' >>$BABBLE
53 @ n_tries = $n_tries + 1
54 if ($n_tries > 288) then
55 echo "Timeout after 5 days $n_have found, expect $n_expect hmi.lev1 records" >>$LOG
56 exit 1
57 endif
58 end
59
60 exit 0