--- mitgcm.org/scripts/check_outp 2013/02/24 15:29:05 1.35 +++ mitgcm.org/scripts/check_outp 2013/04/05 21:15:52 1.38 @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.35 2013/02/24 15:29:05 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.38 2013/04/05 21:15:52 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 ;; @@ -294,12 +306,37 @@ INDIR="/u/u0/httpd/html/testing/results/$PERIOD" #INDIR="/export/export-7/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