--- mitgcm.org/scripts/check_outp 2012/09/08 14:25:13 1.34 +++ mitgcm.org/scripts/check_outp 2013/07/10 16:32:53 1.39 @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.34 2012/09/08 14:25:13 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.39 2013/07/10 16:32:53 jmc Exp $ # # The purpose of this script is to compare # the latest output with the previous one (from the same platform with @@ -14,6 +14,8 @@ echo "where possible OPTIONS are:" echo " (-h|-help) print usage" echo " (-v|-verbose) verbose mode" + echo " (-t|-test4update) do nothing if previous output newer than" + echo " emails-processing log-file '$PRC_MAILS'" echo " (-l |-list )MACHINES check platforms from this list" echo " [def=\"$MACHINES\"]" echo " (-d |-day )FIRSTDAY select output from day=\"YYYYMMDD\"" @@ -99,8 +101,9 @@ fi fi - ADJOINT= - TANGLIN= + ADJOINT=0 + TANGLIN=0 + OPENAD=0 RESTART=0 EXTRA= FAST=0 @@ -109,10 +112,14 @@ MTH=0 UR4=0 if test -r $dir/summary.txt ; then - comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null` - eval $comm - comm=`grep 'TANGLIN=true' $dir/summary.txt 2>/dev/null` - eval $comm + ADJOINT=`grep -c -i '^ADJOINT' $dir/summary.txt` + if test "x$ADJOINT" = x1 ; then + OPENAD=`grep -c '^Adjoint .* OpenAD' $dir/summary.txt` + fi + TANGLIN=`grep -c -i '^TANGLIN' $dir/summary.txt` + if test "x$TANGLIN" = x1 ; then + OPENAD=`grep -c '^TangLin .* OpenAD' $dir/summary.txt` + fi RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt` comm=`grep '^run: .*testreport.* ' $dir/summary.txt` EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"` @@ -144,14 +151,16 @@ UR4=`echo "$comm" | grep -c " -*-ur4\>"` fi fi - if test "x$ADJOINT" = xtrue ; then - kind="adjoint" ; order=0 - elif test "x$TANGLIN" = xtrue ; then - kind="tanglin" ; order=1 + if test "x$ADJOINT" = x1 ; then + kind="adm-TAF" ; order=0 + if test "x$OPENAD" = x1 ; then kind="adm-OAD" ; order=2 ; fi + elif test "x$TANGLIN" = x1 ; then + kind="tlm-TAF" ; order=1 + if test "x$OPENAD" = x1 ; then kind="tlm-OAD" ; order=3 ; fi elif test "x$RESTART" = x0 ; then - kind="forward" ; order=2 + kind="forward" ; order=4 else - kind="restart" ; order=3 + kind="restart" ; order=5 fi order=`expr $order + 10 \* $EXTRA` order=`printf '%3.3i' $order` @@ -206,6 +215,7 @@ #CURR_PER=`date +%Y`"_"`date +%m` CURR_DAY=`date +%Y%m%d` +PRC_MAILS='prc_emails_'`date +%m%d` # defaults MACHINES='_All_' FIRSTDAY=$CURR_DAY @@ -215,6 +225,7 @@ NBLDIFF=5 ADDRESS='none' dBug=f +t4update=0 sTime=`date` #- to get case insensitive "ls" (and order of tested experiments) export LC_ALL="en_US.UTF-8" @@ -236,6 +247,7 @@ -help | --help | -h | --h) usage ;; -verbose | --verbose | -v | --v) dBug=t ;; + -test4update | --test4update | -t | --t) t4update=1 ;; -list | --list | -l | --l) ac_prev=MACHINES ;; -list=* | --list=*) MACHINES=$ac_optarg ;; @@ -292,14 +304,39 @@ #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD" INDIR="/u/u0/httpd/html/testing/results/$PERIOD" -#INDIR="/export/export-7/u/u2/jmc/mitgcm/test_web/results/$PERIOD" +#INDIR="/u/u2/jmc/mitgcm/test_web/results/$PERIOD" + +#- a short summary of this checking : +OUTPSUM=`echo $LASTDAY | sed 's/^20../_/'` +OUTPSUM=`basename $0`"$OUTPSUM.txt" if test $OUTPFIL = '-1' ; then OUTPFIL='TTT.'$$ +fi +if test $t4update = 1 ; then + if test -f $PRC_MAILS -a -f $OUTPSUM -a $FIRSTDAY = $CURR_DAY ; then + #- if update-log-file is older than previous output summary, just return + if test $PRC_MAILS -ot $OUTPSUM ; then + echo ' '$CMDLINE | tee -a $OUTPSUM + echo " t4update: skip "`basename $0`" ( $PRC_MAILS older than $OUTPSUM )" | tee -a $OUTPSUM + echo "End time: "`date` | tee -a $OUTPSUM + exit 0 + else + if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi + echo " t4update: run "`basename $0`" ( $PRC_MAILS newer than $OUTPSUM )" | tee $OUTPFIL + fi + else + if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi + echo " t4update ignored (not current day or $PRC_MAILS or $OUTPSUM missing)" | tee $OUTPFIL + fi elif test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' + touch $OUTPFIL fi -echo "CMDLINE='$CMDLINE'" > $OUTPFIL +if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi +echo ' '$CMDLINE > $OUTPSUM + +echo "CMDLINE='$CMDLINE'" >> $OUTPFIL echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL echo "INDIR='$INDIR'" >> $OUTPFIL echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL @@ -322,12 +359,6 @@ exit 3 fi -#- 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 - if test $FIRSTDAY = $LASTDAY ; then echo -n "Checking latest output from $FIRSTDAY" | tee -a $OUTPSUM else @@ -344,9 +375,8 @@ ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all if test "x$MACHINES" = "x_All_" ; then - MACHINES="faulks meander aces- acesgrid baudelaire dickens danton beagle harbor" - MACHINES="$MACHINES pleiades iblade rays solasrv sx8" - MACHINES="$MACHINES trane dodongo dokdo stomp bigred" + MACHINES="aces- acesgrid baudelaire dickens danton beagle" + MACHINES="$MACHINES pleiades iblade sx8 uv100 solasrv stomp weber" MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq` for madd in $MALL ; do @@ -392,7 +422,7 @@ keys=`cat ./slist | cut -d " " -f 1 | sort | uniq` for key in $keys ; do - ctot=`expr $ctot + 1` + ctot=`expr $ctot + 1` sline=`grep "^$key " ./slist | head -1` sdir=`echo $sline | cut -d " " -f 5` type=`echo $sline | cut -d " " -f 4` @@ -433,21 +463,34 @@ xx=`( echo 5 ; sed -n '/^ OPTFILE=/=' $outp ) | tail -1` sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \ | grep -v '^[A-S][a-t]* time: ' > tmpfp - #-- re-order list of exp (according to local "sort" order) - listD=`grep '^[YN] [YN] [YN] [YN]' tmpfs | awk '{print $NF}' | sort` - for xx in $listD - do - sed "/ $xx\$/d" tmpfs > tmpfn - sed -n "/ $xx\$/p" tmpfs >> tmpfn - mv tmpfn tmpfs - done - listD=`grep '^[YN] [YN] [YN] [YN]' tmpfp | awk '{print $NF}' | sort` - for xx in $listD - do - sed "/ $xx\$/d" tmpfp > tmpfn - sed -n "/ $xx\$/p" tmpfp >> tmpfn - mv tmpfn tmpfp - done + #-- check if list of exp are the same (and in the same order) + sed 's/ (e=.*, w=.*)$//' tmpfs > tmpfn + listDs=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'` + #mv -f tmpfn tmpfs + rm -f tmpfn + sed 's/ (e=.*, w=.*)$//' tmpfp > tmpfn + listDp=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'` + #mv -f tmpfn tmpfp + rm -f tmpfn + #echo "listDs='$listDs'" ; echo "listDp='$listDp'" + if test "$listDs" != "$listDp" ; then + if test $dBug = 't' ; then echo ' -> re-order list of exp' ; fi + #-- re-order list of exp (according to local "sort" order) + listDs=`echo "$listDs" | sort` + for xx in $listDs ; do + sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfs > tmpfn + sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfs >> tmpfn + mv -f tmpfn tmpfs + done + listDp=`echo "$listDp" | sort` + for xx in $listDp ; do + sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfp > tmpfn + sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfp >> tmpfn + mv -f tmpfn tmpfp + done + #else + # echo 'same list of exp => skip re-ordering' + fi echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL diff tmpfs tmpfp > tmpdf yy=$?