/[MITgcm]/mitgcm.org/scripts/check_outp
ViewVC logotype

Diff of /mitgcm.org/scripts/check_outp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.34 by jmc, Sat Sep 8 14:25:13 2012 UTC revision 1.39 by jmc, Wed Jul 10 16:32:53 2013 UTC
# Line 14  usage() Line 14  usage()
14      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
15      echo "  (-h|-help)            print usage"      echo "  (-h|-help)            print usage"
16      echo "  (-v|-verbose)         verbose mode"      echo "  (-v|-verbose)         verbose mode"
17        echo "  (-t|-test4update)     do nothing if previous output newer than"
18        echo "                         emails-processing log-file '$PRC_MAILS'"
19      echo "  (-l |-list )MACHINES  check platforms from this list"      echo "  (-l |-list )MACHINES  check platforms from this list"
20      echo "                         [def=\"$MACHINES\"]"      echo "                         [def=\"$MACHINES\"]"
21      echo "  (-d |-day  )FIRSTDAY  select output from day=\"YYYYMMDD\""      echo "  (-d |-day  )FIRSTDAY  select output from day=\"YYYYMMDD\""
# Line 99  make_resdir_list() Line 101  make_resdir_list()
101                  fi                  fi
102              fi              fi
103    
104              ADJOINT=              ADJOINT=0
105              TANGLIN=              TANGLIN=0
106                OPENAD=0
107              RESTART=0              RESTART=0
108              EXTRA=              EXTRA=
109              FAST=0              FAST=0
# Line 109  make_resdir_list() Line 112  make_resdir_list()
112              MTH=0              MTH=0
113              UR4=0              UR4=0
114              if test -r $dir/summary.txt ; then              if test -r $dir/summary.txt ; then
115                  comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`                  ADJOINT=`grep -c -i '^ADJOINT' $dir/summary.txt`
116                  eval $comm                  if test "x$ADJOINT" = x1 ; then
117                  comm=`grep 'TANGLIN=true' $dir/summary.txt 2>/dev/null`                    OPENAD=`grep -c '^Adjoint .* OpenAD' $dir/summary.txt`
118                  eval $comm                  fi
119                    TANGLIN=`grep -c -i '^TANGLIN' $dir/summary.txt`
120                    if test "x$TANGLIN" = x1 ; then
121                      OPENAD=`grep -c '^TangLin .* OpenAD' $dir/summary.txt`
122                    fi
123                  RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`                  RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
124                  comm=`grep '^run: .*testreport.* ' $dir/summary.txt`                  comm=`grep '^run: .*testreport.* ' $dir/summary.txt`
125                  EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"`                  EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"`
# Line 144  make_resdir_list() Line 151  make_resdir_list()
151                     UR4=`echo "$comm" | grep -c " -*-ur4\>"`                     UR4=`echo "$comm" | grep -c " -*-ur4\>"`
152                  fi                  fi
153              fi              fi
154              if test "x$ADJOINT" = xtrue ; then              if test "x$ADJOINT" = x1 ; then
155                  kind="adjoint" ; order=0                  kind="adm-TAF" ; order=0
156              elif test "x$TANGLIN" = xtrue ; then                  if test "x$OPENAD" = x1 ; then kind="adm-OAD" ; order=2 ; fi
157                  kind="tanglin" ; order=1              elif test "x$TANGLIN" = x1 ; then
158                    kind="tlm-TAF" ; order=1
159                    if test "x$OPENAD" = x1 ; then kind="tlm-OAD" ; order=3 ; fi
160              elif test "x$RESTART" = x0 ; then              elif test "x$RESTART" = x0 ; then
161                  kind="forward" ; order=2                  kind="forward" ; order=4
162              else              else
163                  kind="restart" ; order=3                  kind="restart" ; order=5
164              fi              fi
165              order=`expr $order + 10 \* $EXTRA`              order=`expr $order + 10 \* $EXTRA`
166              order=`printf '%3.3i' $order`              order=`printf '%3.3i' $order`
# Line 206  make_resdir_list() Line 215  make_resdir_list()
215    
216  #CURR_PER=`date +%Y`"_"`date +%m`  #CURR_PER=`date +%Y`"_"`date +%m`
217  CURR_DAY=`date +%Y%m%d`  CURR_DAY=`date +%Y%m%d`
218    PRC_MAILS='prc_emails_'`date +%m%d`
219  # defaults  # defaults
220  MACHINES='_All_'  MACHINES='_All_'
221  FIRSTDAY=$CURR_DAY  FIRSTDAY=$CURR_DAY
# Line 215  OUTPFIL=`basename $0`'.log' Line 225  OUTPFIL=`basename $0`'.log'
225  NBLDIFF=5  NBLDIFF=5
226  ADDRESS='none'  ADDRESS='none'
227  dBug=f  dBug=f
228    t4update=0
229  sTime=`date`  sTime=`date`
230  #- to get case insensitive "ls" (and order of tested experiments)  #- to get case insensitive "ls" (and order of tested experiments)
231  export LC_ALL="en_US.UTF-8"  export LC_ALL="en_US.UTF-8"
# Line 236  for ac_option ; do Line 247  for ac_option ; do
247                    
248          -help | --help | -h | --h) usage ;;          -help | --help | -h | --h) usage ;;
249          -verbose | --verbose | -v | --v) dBug=t ;;          -verbose | --verbose | -v | --v) dBug=t ;;
250            -test4update | --test4update | -t | --t) t4update=1 ;;
251                    
252          -list  | --list  | -l | --l) ac_prev=MACHINES ;;          -list  | --list  | -l | --l) ac_prev=MACHINES ;;
253          -list=* | --list=*) MACHINES=$ac_optarg ;;          -list=* | --list=*) MACHINES=$ac_optarg ;;
# Line 292  PERIOD=`echo $PERIOD | sed 's/^[0-9][0-9 Line 304  PERIOD=`echo $PERIOD | sed 's/^[0-9][0-9
304    
305  #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD"  #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD"
306  INDIR="/u/u0/httpd/html/testing/results/$PERIOD"  INDIR="/u/u0/httpd/html/testing/results/$PERIOD"
307  #INDIR="/export/export-7/u/u2/jmc/mitgcm/test_web/results/$PERIOD"  #INDIR="/u/u2/jmc/mitgcm/test_web/results/$PERIOD"
308    
309    #- a short summary of this checking :
310    OUTPSUM=`echo $LASTDAY | sed 's/^20../_/'`
311    OUTPSUM=`basename $0`"$OUTPSUM.txt"
312    
313  if test $OUTPFIL = '-1' ; then  if test $OUTPFIL = '-1' ; then
314    OUTPFIL='TTT.'$$    OUTPFIL='TTT.'$$
315    fi
316    if test $t4update = 1 ; then
317      if test -f $PRC_MAILS -a -f $OUTPSUM -a $FIRSTDAY = $CURR_DAY ; then
318        #- if update-log-file is older than previous output summary, just return
319        if test $PRC_MAILS -ot $OUTPSUM ; then
320          echo ' '$CMDLINE | tee -a $OUTPSUM
321          echo " t4update: skip "`basename $0`" ( $PRC_MAILS older than $OUTPSUM )" | tee -a $OUTPSUM
322          echo "End  time:   "`date` | tee -a $OUTPSUM
323          exit 0
324        else
325          if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi
326          echo " t4update: run "`basename $0`" ( $PRC_MAILS newer than $OUTPSUM )" | tee $OUTPFIL
327        fi
328      else
329          if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi
330          echo " t4update ignored (not current day or $PRC_MAILS or $OUTPSUM missing)" | tee $OUTPFIL
331      fi
332  elif test -e $OUTPFIL ; then  elif test -e $OUTPFIL ; then
333    mv -f $OUTPFIL $OUTPFIL'_bak'    mv -f $OUTPFIL $OUTPFIL'_bak'
334      touch $OUTPFIL
335  fi  fi
336  echo "CMDLINE='$CMDLINE'" > $OUTPFIL  if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi
337    echo ' '$CMDLINE > $OUTPSUM
338    
339    echo "CMDLINE='$CMDLINE'" >> $OUTPFIL
340  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL
341  echo "INDIR='$INDIR'" >> $OUTPFIL  echo "INDIR='$INDIR'" >> $OUTPFIL
342  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL
# Line 322  else Line 359  else
359    exit 3    exit 3
360  fi  fi
361    
 #- a short summary of this checking :  
 OUTPSUM=`echo $LASTDAY | sed 's/^20../_/'`  
 OUTPSUM=`basename $0`"$OUTPSUM.txt"  
 if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi  
 echo ' '$CMDLINE > $OUTPSUM  
   
362  if test $FIRSTDAY = $LASTDAY ; then  if test $FIRSTDAY = $LASTDAY ; then
363    echo -n "Checking latest output from $FIRSTDAY" | tee -a $OUTPSUM    echo -n "Checking latest output from $FIRSTDAY" | tee -a $OUTPSUM
364  else  else
# Line 344  echo "     name     checked   comp    Di Line 375  echo "     name     checked   comp    Di
375  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all
376    
377  if test "x$MACHINES" = "x_All_" ; then  if test "x$MACHINES" = "x_All_" ; then
378    MACHINES="faulks meander aces- acesgrid baudelaire dickens danton beagle harbor"    MACHINES="aces- acesgrid baudelaire dickens danton beagle"
379    MACHINES="$MACHINES pleiades iblade rays solasrv sx8"    MACHINES="$MACHINES pleiades iblade sx8 uv100 solasrv stomp weber"
   MACHINES="$MACHINES trane dodongo dokdo stomp bigred"  
380    
381    MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`    MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
382    for madd in $MALL ; do    for madd in $MALL ; do
# Line 392  for pname in $MACHINES ; do Line 422  for pname in $MACHINES ; do
422          keys=`cat ./slist | cut -d " " -f 1 | sort | uniq`          keys=`cat ./slist | cut -d " " -f 1 | sort | uniq`
423    
424          for key in $keys ; do          for key in $keys ; do
425            ctot=`expr $ctot + 1`            ctot=`expr $ctot + 1`
426            sline=`grep "^$key " ./slist | head -1`            sline=`grep "^$key " ./slist | head -1`
427            sdir=`echo $sline | cut -d " " -f 5`            sdir=`echo $sline | cut -d " " -f 5`
428            type=`echo $sline | cut -d " " -f 4`            type=`echo $sline | cut -d " " -f 4`
# Line 433  for pname in $MACHINES ; do Line 463  for pname in $MACHINES ; do
463              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outp ) | tail -1`              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outp ) | tail -1`
464              sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \              sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \
465                                  | grep -v '^[A-S][a-t]* time:  ' > tmpfp                                  | grep -v '^[A-S][a-t]* time:  ' > tmpfp
466              #-- re-order list of exp (according to local "sort" order)              #-- check if list of exp are the same (and in the same order)
467              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfs | awk '{print $NF}' | sort`              sed 's/  (e=.*, w=.*)$//' tmpfs > tmpfn
468              for xx in $listD              listDs=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'`
469              do              #mv -f tmpfn tmpfs
470                  sed "/ $xx\$/d" tmpfs > tmpfn              rm -f tmpfn
471                  sed -n "/ $xx\$/p" tmpfs >> tmpfn              sed 's/  (e=.*, w=.*)$//' tmpfp > tmpfn
472                  mv tmpfn tmpfs              listDp=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'`
473              done              #mv -f tmpfn tmpfp
474              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfp | awk '{print $NF}' | sort`              rm -f tmpfn
475              for xx in $listD              #echo "listDs='$listDs'" ;  echo "listDp='$listDp'"
476              do              if test "$listDs" != "$listDp" ; then
477                  sed "/ $xx\$/d" tmpfp > tmpfn                  if test $dBug = 't' ; then echo ' -> re-order list of exp' ; fi
478                  sed -n "/ $xx\$/p" tmpfp >> tmpfn                  #-- re-order list of exp (according to local "sort" order)
479                  mv tmpfn tmpfp                  listDs=`echo "$listDs" | sort`
480              done                  for xx in $listDs ; do
481                        sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfs > tmpfn
482                        sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfs >> tmpfn
483                        mv -f tmpfn tmpfs
484                    done
485                    listDp=`echo "$listDp" | sort`
486                    for xx in $listDp ; do
487                        sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfp > tmpfn
488                        sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfp >> tmpfn
489                        mv -f tmpfn tmpfp
490                    done
491                #else
492                #   echo 'same list of exp => skip re-ordering'
493                fi
494              echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL              echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL
495              diff tmpfs tmpfp > tmpdf              diff tmpfs tmpfp > tmpdf
496              yy=$?              yy=$?

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.22