--- mitgcm.org/scripts/check_outp 2011/08/09 16:40:29 1.29 +++ mitgcm.org/scripts/check_outp 2013/03/07 21:57:45 1.37 @@ -1,12 +1,11 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.29 2011/08/09 16:40:29 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/check_outp,v 1.37 2013/03/07 21:57:45 jmc Exp $ # # The purpose of this script is to compare # the latest output with the previous one (from the same platform with # same optfile) - usage() { echo @@ -15,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\"" @@ -101,26 +102,67 @@ fi ADJOINT= + TANGLIN= RESTART=0 + EXTRA= FAST=0 DVLP=0 + MPI=0 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 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt` - FAST=`grep -c "^run: .*testreport.* '*-fast'*" $dir/summary.txt` + comm=`grep '^run: .*testreport.* ' $dir/summary.txt` + EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"` + if test "x$EXTRA" = x ; then + EXTRA=`echo "$comm" | grep " -*-t\>" | sed -e "s/^.*-*-t\>//" -e "s/ -.*$//"` + fi + if test "x$EXTRA" = x ; then EXTRA=0 ; else + #echo -n "EXTRA=$EXTRA" + nn0=`echo $EXTRA | sed "s/ *' *//g" | wc -w` + nn1=`echo $EXTRA | sed "s/ *' *//g" | tr ' ' '\n' | grep -c "\"` if test "x$FAST" = x0 ; then - FAST=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt` + FAST=`echo "$comm" | grep -c " '*-noieee'*"` + fi + DVLP=`echo "$comm" | grep -c " -*-devel\>"` + MPI=`echo "$comm" | grep -c " -*-mpi\>"` + if test "x$MPI" = x0 ; then + MPI=`echo "$comm" | grep -c " -*-MPI\>"` + fi + MTH=`echo "$comm" | grep -c " -*-mth\>"` + UR4=`echo "$comm" | grep -c " -*-use_r4\>"` + if test "x$UR4" = x0 ; then + UR4=`echo "$comm" | grep -c " -*-ur4\>"` fi - DVLP=`grep -c "^run: .*testreport.* '*-devel'*" $dir/summary.txt` - MTH=`grep -c "^run: .*testreport.* -mth" $dir/summary.txt` fi - if test "x$RESTART" = x0 ; then - kind="forward" - test "x$ADJOINT" = xtrue && kind="adjoint" + if test "x$ADJOINT" = xtrue ; then + kind="adjoint" ; order=0 + elif test "x$TANGLIN" = xtrue ; then + kind="tanglin" ; order=1 + elif test "x$RESTART" = x0 ; then + kind="forward" ; order=2 else - kind="restart" + kind="restart" ; order=3 + fi + order=`expr $order + 10 \* $EXTRA` + order=`printf '%3.3i' $order` + if test "x$UR4" = x1 ; then + OPTFILE="${OPTFILE}.use_r4" + fi + if test "x$MPI" = x1 ; then + yy=`echo $OPTFILE | grep -c '+mpi'` + if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi" ; fi fi if test "x$MTH" = x1 ; then yy=`echo $OPTFILE | grep -c '+mth$'` @@ -136,10 +178,10 @@ ttt=`echo $day | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'` day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'` - if [ $day -lt $BEFORE ] ; then - echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist + if [ $day -lt $BEFORE ] ; then + echo "$OPTFILE$order $day $OPTFILE $kind $i" >> ./plist elif [ $day -ge $FIRSTDAY -a $day -le $LASTDAY ] ; then - echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist + echo "$OPTFILE$order $day $OPTFILE $kind $i" >> ./slist else if test $dBug = 't' ; then echo "discard day='$day' from: $i" | tee -a $OUTPFIL @@ -166,6 +208,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 @@ -175,6 +218,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" @@ -185,9 +229,9 @@ # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue + eval "$ac_prev=\$ac_option" + ac_prev= + continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` @@ -196,6 +240,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 ;; @@ -254,12 +299,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 @@ -282,12 +352,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 @@ -304,9 +368,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