New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 8843 for branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh – NEMO

Ignore:
Timestamp:
2017-11-29T12:20:30+01:00 (6 years ago)
Author:
nicolasmartin
Message:

Review forcing inputs management + cosmetic changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh

    r8834 r8843  
    2222    local outline=$( printf "%${char_nb}s" ) 
    2323 
    24     printf "\nStep.....\n%s\n%s\n" "$1" ${outline// /-} 
     24    printf "\n\nStep.....\n%s\n%s\n\n" "$1" ${outline// /-} 
    2525} 
    2626 
     
    3434    echo     ${TRUST_TEST_DIR} 
    3535 
    36     echo 'Date'             > ${file_date}; echo 'Result'       > ${file_rslt} 
    37     echo 'Status'           > ${file_stat}; echo 'NEMOGCM'      > ${file_nemo} 
    38     echo 'XIOS'          > ${file_xios}; echo 'Fortran'      > ${file_cmpf} 
    39     echo 'MPI'           > ${file_lmpi}; echo 'NetCDF'       > ${file_ncdf} 
    40     echo 'Inputs'        > ${file_inpt}; echo 'Elapsed time' > ${file_time} 
    41     echo 'RAM (Phy./Virt.)' > ${file_memy}; echo 'Comments'     > ${file_note} 
     36    echo 'Date'             > ${file_date}; echo 'Result'   > ${file_rslt} 
     37    echo 'Status'           > ${file_stat}; echo 'NEMOGCM'  > ${file_nemo} 
     38    echo 'XIOS'          > ${file_xios}; echo 'Fortran'  > ${file_cmpf} 
     39    echo 'MPI'           > ${file_lmpi}; echo 'NetCDF'   > ${file_ncdf} 
     40    echo 'Inputs'        > ${file_inpt}; echo 'Time'    > ${file_time} 
     41    echo 'RAM (Phy./Virt.)' > ${file_memy}; echo 'Comments' > ${file_note} 
    4242 
    4343    ## 'FAILED' status with 'Unknown error' by default 
     
    6666 
    6767   echo $dir && ${TRUST_SVN_ACTION} ${TRUST_SVN_NEMOGCM}/$dir || get_out C 
    68    rev_loc=$( svn info ${TRUST_SVN_NEMOGCM}/$dir     \ 
    69               | awk '/Last Changed Rev/ {print $NF}'   ) 
     68   rev_loc=$( svn info ${TRUST_SVN_NEMOGCM}/$dir         \ 
     69                  | awk '/Last Changed Rev/ {print $NF}'   ) 
    7070 
    7171   ## Keep last rev. nb 
     
    8787 
    8888    ## Sourcing environment 
    89     . ${TRUST_JOB_ENV} 
     89    . ${TRUST_JOB_ENV} >& /dev/null 
    9090 
    9191    for str in ${TRUST_COMPILE_FORTRAN}                         \ 
     
    101101   if [[ $str =~ ${TRUST_COMPILE_FORTRAN}|${TRUST_IO_CDO} ]]; then 
    102102       ver=$( $str --version 2>&1 | grep -m1 -oe '\<[0-9. ]*\>' \ 
    103          | xargs echo $str                                   ) 
     103             | xargs echo $str                               ) 
    104104   fi 
    105105 
     
    107107   ver=$( echo $ver | sed 's|[/-]| |g' ) 
    108108 
    109    echo $ver \ 
     109   echo $ver        \ 
    110110       >> model.log 
    111111    done 
     
    130130 
    131131    rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' ) 
    132     echo 'XIOS '$rev \ 
    133    >> ${TRUST_TEST_DIR}/model.log 
     132    printf 'XIOS                 branch %s rev. %s\n' \ 
     133   $( basename ${TRUST_IO_XIOS} ) $rev           \ 
     134   | tee -a ${TRUST_TEST_DIR}/model.log 
    134135    echo "<a href=\"${TRUST_SVN_REPO}/ioserver/changeset/$rev target=\"_blank\">$rev</a>" \ 
    135136   >> ${TRUST_TEST_DIR}/${file_xios} 
     
    174175 
    175176get_inputs() { 
    176      # List archive content & extract it by default 
    177     local inputs_list=" 
    178         for archive in \${TRUST_IO_FORC_TAR}; do 
    179             tar -tvf \${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt; 
    180          done 
    181          " 
    182     local inputs_get=" 
    183         for archive in \${TRUST_IO_FORC_TAR}; do 
    184             tar -vxf \${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null; 
    185          done 
    186          " 
    187  
    188     ## List & copy files without archive 
    189     if [ -z "${TRUST_IO_FORC_TAR}" ]; then 
    190         inputs_list=" ls -lh \${TRUST_IO_FORC_PATH}/* >> inputs_list.txt" 
    191         inputs_get=" \cp     \${TRUST_IO_FORC_PATH}/* .                 " 
    192     fi 
    193  
    194177    cd ${TRUST_TEST_DIR} 
     178 
     179    ## Test forcing directory 
     180    if [[ ! ${TRUST_IO_FORC_PATH} && ${TRUST_IO_FORC_PATH-_} ]]; then 
     181 
     182   echo 'No forcing files needed' 
     183 
     184    else 
     185 
     186   ## Test forcing archive 
     187   if [ -n "${TRUST_IO_FORC_TAR}" ]; then 
     188 
     189       echo 'Forcing archive(s): '${TRUST_IO_FORC_TAR} 
     190 
     191       # List archive content & extract it by default 
     192       local inputs_list=" 
     193            for archive in \${TRUST_IO_FORC_TAR}; do 
     194      tar -tvf \${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt; 
     195            done 
     196            " 
     197       local inputs_get=" 
     198            for archive in \${TRUST_IO_FORC_TAR}; do 
     199      tar -vxf \${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null; 
     200            done 
     201            " 
     202 
     203   else 
     204 
     205       echo 'Forcing directory: '${TRUST_IO_FORC_PATH} 
     206 
     207       ## List & copy files without archive 
     208            local inputs_list=" ls -lh \${TRUST_IO_FORC_PATH}/* >> inputs_list.txt" 
     209            local inputs_get=" \cp     \${TRUST_IO_FORC_PATH}/* .                 " 
     210   fi 
     211 
     212    fi 
     213 
    195214    eval ${inputs_list} 
    196     echo ${inputs_get}; eval ${inputs_get} 
     215    eval ${inputs_get} 
    197216 
    198217    if [ $( find -name '*.gz' -print -quit ) ]; then 
     
    299318   local time_cpu=$( eval ${TRUST_JOB_TIME} ) 
    300319 
    301    printf "Elapsed time: " 
     320   printf "Time: " 
    302321   echo ${time_cpu} | tee -a ${file_time} 
    303322 
     
    310329   local memory_vmax=$( eval ${TRUST_JOB_RAM_V} ) 
    311330 
    312    printf "Memory max usage (physical/virtual): " 
     331   printf "Max memory usage (physical/virtual): " 
    313332   echo ${memory_pmax}' / '${memory_vmax} | tee -a ${file_memy} 
    314333    fi 
     
    375394   ############################################################### 
    376395   filebases=$( find -regextype sed -regex ".*${TRUST_CFG_NEW}.*_[0-9]\{4\}\.nc" \ 
    377                 | sed 's/\(.*\)_.*/\1/' | sort -u                                  ) 
     396                    | sed 's/\(.*\)_.*/\1/' | sort -u                              ) 
    378397 
    379398   for filebase in $filebases; do 
    380399 
    381400       ndomain=$( find -regex ".*${filebase}_[0-9]*.nc" \ 
    382              | wc -l | awk '{print $1}'              ) 
     401                 | wc -l | awk '{print $1}'          ) 
    383402 
    384403            ##################################################### 
     
    486505 
    487506        ## Send mail only when FAILED 
    488    if [[ ! -z "${TRUST_TEST_MAILING}"        \ 
     507   if [[ -n "${TRUST_TEST_MAILING}"          \ 
    489508         && ${TRUST_FLAG_RESULT} == 'FAILED'   ]]; then 
    490509 
     
    576595   comments 'E R R O R' 
    577596   [ -e time.step ] && time_step=$( cat time.step ) 
    578    TRUST_FLAG_ERROR+=' '$time_step 
     597   TRUST_FLAG_ERROR+=' '${time_step:=0} 
    579598    else 
    580599   comments 'W A R N I N G' 
     
    587606 
    588607    ## Last messenger files 
    589     sed -i "2 s/.*/$TRUST_FLAG_RESULT=/" ${file_rslt} 
    590     sed -i "2 s/.*/$TRUST_FLAG_ERROR/"   ${file_stat} 
     608    sed -i "2 s/.*/$TRUST_FLAG_RESULT/" ${file_rslt} 
     609    sed -i "2 s/.*/$TRUST_FLAG_ERROR/"  ${file_stat} 
    591610 
    592611    ## Save tested configuration if trusting failed in production mode (-p|--prod) 
Note: See TracChangeset for help on using the changeset viewer.