source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh @ 5292

Last change on this file since 5292 was 5292, checked in by nicolasmartin, 6 years ago

dev_r5092_CNRS_SETTE Standalone TRUST directory for regular NEMO configuration testing

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 3.6 KB
Line 
1#!/bin/bash
2
3function mesg_make { 
4    paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
5    cat trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
6}
7
8#=============================================
9function mesg_publish { 
10 
11if [ $PUBLISH -eq 1 ]; then
12
13  if [ -f ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt ] ; then
14      tail -1 trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt >> ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt
15  else
16      cp      trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt    ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt
17  fi
18
19  cp trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt ${DIR_TEST}
20#  chmod o+r ${DIR_TEST}/trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
21 
22#  rm -rf              ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
23#  cp -alf ${DIR_TEST} ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
24#  chmod o+rX          ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
25 
26  # Send mail only when FAILED
27  if [[ grep 'FAILED' mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt && ! -z $MAIL ]]; then
28      cat << END_MAIL > ${DIR_TEST}/trusting.mail
29XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
30Dear $USER,
31
32The trusting sequence for ${CONF_REF} has failed.
33Please consult http://webservices.ipsl.fr/trusting/
34
35Failed at step: `tail -n 1 mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt`
36Directory : ${DIR_TEST}
37
38XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
39
40END_MAIL
41      mail -s "[trusting ${CONF_REF}] FAILED" $MAIL < ${DIR_TEST}/trusting.mail
42  fi
43
44fi
45
46}
47
48#=============================================
49function getout { 
50   cd ${DIR_TEST}
51        mesg_make; mesg_publish
52
53        # Add tar saved into {DIR_STOR}
54   find ${DIR_SCRA}/trusting/${CONF_REF}/* -prune -mtime +7 -exec /bin/rm -rf {} \; > /dev/null 2>&1
55        [ -f ${DIR_STOR}/${CONF_REF}.tar ] && \rm ${DIR_STOR}/${CONF_REF}.tar
56        tar -cf ${DIR_STOR}/${CONF_REF}.tar .
57
58        exit
59}
60
61#=============================================
62function diffnc {
63    stat=100; file1=$1; file2=$2
64
65    cdo diffv $file1 $file2 > out_tmp
66    ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 "records differ" out_tmp | awk '-Fof' '{print $1}' )
67    [ -f out_tmp ] && rm out_tmp
68
69    return $stat
70} 
71
72#---------------------------------------------
73function diff_trusting {
74
75    name_first=${JOB_NAME}
76    name_second=EXP00C
77    rep_ref=EXP00C_REFE
78    experiment_name=trusting
79    tagname=TEST
80    #listcomp="ATM SBG SRF CPL ICE MBG OCE"
81    listcomp="ATM SRF CPL ICE MBG OCE"
82    result_final=0
83
84# Output 
85    cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first}
86    for comp in ${listcomp}; do
87   echo ${comp}
88   cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first}/${comp}/Output
89   listfreq=$(ls -d MO/ DA/)
90   for freq in ${listfreq}; do
91            echo ${freq}
92            cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first}/${comp}/Output/${freq}
93            listfile=$( ls *.nc )
94            for file in ${listfile}; do
95      var=$( echo $file | sed -e "s/^${name_first}//" )
96      result=$( diffnc ${name_first}${var} ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${CONFIG_WORK}/${rep_ref}/${comp}/Output/${freq}${name_second}${var} )
97      result=$?
98      echo 'diffnc '${name_first}${var} ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/TEST/${CONFIG_WORK}/${rep_ref}/${comp}/Output/${freq}${name_second}${var}
99      echo $result
100      (( result_final = result_final + result ))
101            done
102   done
103    done
104    return $result_final
105
106}
Note: See TracBrowser for help on using the repository browser.