Ignore:
Timestamp:
03/05/13 15:39:16 (11 years ago)
Author:
sdipsl
Message:
  • see #104 homegenize sys lib so as to ease maintenance.
  • all sys lib must have the same functions (some of them being dummy or not) depending on centre environment
  • indentation clean-up (from emacs macro)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh

    r809 r811  
    123123 
    124124#==================================================== 
    125 #- ARCHIVE (dedicated to large files) 
     125#- ARCHIVE 
    126126typeset ARCHIVE=${ARCHIVE:=/home/scratch01/${LOGIN}} 
    127127 
     
    173173#D- 
    174174function IGCM_sys_ChangeArchive { 
    175  
    176175  IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive " 
    177  
    178176} 
    179177 
     
    209207    ${@} 
    210208EOF 
    211   if [ $? -gt 0 ] ; then 
    212     echo "IGCM_sys_RshArchive : erreur." 
     209  status=$? 
     210  if [ ${status} -gt 0 ] ; then 
     211    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" 
    213212    IGCM_debug_Exit "IGCM_sys_RshArchive" 
    214213  fi 
     
    227226  fi 
    228227 
    229   #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 
    230   #cat tmp_IGCM_sys_RshPost_$$ 
    231228  # keep standard input (stdin) for the loop onto temporary file 
    232229  cat >tmp_IGCM_sys_RshPost_$$ 
     
    234231# ============ FRONTEND START ============ # 
    235232 
    236     ssh obelix3 exec /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     233  ssh obelix3 exec /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
    237234  if [ $? -gt 0 ] ; then 
    238235    echo "IGCM_sys_RshPost : erreur." 
     
    279276  fi 
    280277 
     278  sleep 10 
     279  rm -f job_end.mail 
     280 
    281281  if [ $? -gt 0 ] ; then 
    282282    echo "IGCM_sys_SendMail : erreur." 
     
    323323  #- creation de repertoire sur le serveur fichier 
    324324  if [ ! -d ${1} ]; then 
    325     \mkdir -p $1 
    326     if [ $? -gt 0 ] ; then 
    327       echo "IGCM_sys_MkdirArchive : erreur." 
     325    mkdir -p $1 
     326    status=$? 
     327 
     328    if [ ${status} -gt 0 ] ; then 
     329      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
    328330      IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    329331    fi 
     
    437439  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    438440  IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
    439  
    440441  return ${ExistFlag} 
    441442} 
     
    577578    echo "IGCM_sys_Qsub :" $@ 
    578579  fi 
     580  typeset status 
    579581  /usr/local/bin/qsub -q medium -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 
    580   if [ $? -gt 0 ] ; then 
    581     echo "IGCM_sys_Qsub : erreur." 
     582  status=$? 
     583  if [ ${status} -gt 0 ] ; then 
     584    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" 
    582585    IGCM_debug_Exit "IGCM_sys_Qsub" 
    583586  fi 
     
    595598    echo "IGCM_sys_QsubPost :" $@ 
    596599  fi 
     600  typeset status 
    597601  /usr/local/bin/qsub -q medium -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job -v ${listVarEnv} 
    598   if [ $? -gt 0 ] ; then 
    599     echo "IGCM_sys_QsubPost : erreur " $@ 
     602  status=$? 
     603  if [ ${status} -gt 0 ] ; then 
     604    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" 
    600605    IGCM_debug_Exit "IGCM_sys_QsubPost" 
    601606  fi 
     
    719724 
    720725#D-#================================================== 
     726#D-function IGCM_sys_Miror_libIGCM 
     727#D-* Purpose: Mirror libIGCM PATH and lib to frontend 
     728#D-* Examples: 
     729#D- 
     730function IGCM_sys_Mirror_libIGCM { 
     731  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
     732  if ( $DEBUG_sys ) ; then 
     733    echo "IGCM_sys_Mirror_libIGCM" 
     734  fi 
     735 
     736  typeset status 
     737 
     738  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     739 
     740  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
     741  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
     742  status=$? 
     743 
     744  if [ ${status} -gt 0 ] ; then 
     745    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 
     746    cat out_rsync 
     747  fi 
     748  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
     749} 
     750 
     751#D-#================================================== 
    721752#D-function IGCM_sys_Cp 
    722753#D-* Purpose: generic cp 
     
    791822 
    792823  if [ ${status} -gt 0 ] ; then 
    793     echo "IGCM_sys_RmRunDir : error code ${status}" 
     824    echo "IGCM_sys_RmRunDir : rm error code is ${status}." 
    794825    cat out_rsync 
    795826    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
     
    860891 
    861892    if [ ${status} -gt 0 ] ; then 
    862       echo "IGCM_sys_Put_Dir : error code ${status}" 
     893      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" 
    863894      cat out_rsync 
    864895      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     
    892923 
    893924    #USUAL WAY 
    894     \cp -R $1 $2 > out_rsync 2>&1 
     925    \cp -ur $1 $2 > out_rsync 2>&1 
    895926    status=$? 
    896927 
    897928    if [ ${status} -gt 0 ] ; then 
    898       echo "IGCM_sys_Get_Dir : error." 
     929      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" 
    899930      cat out_rsync 
    900931      IGCM_debug_Exit "IGCM_sys_Get_Dir" 
     
    925956    fi 
    926957 
    927     typeset status 
    928  
    929     #USUAL WAY 
    930     cp -RL $1 $2 > out_rsync 2>&1 
    931     status=$? 
     958    typeset NB_ESSAI DELAI status i 
     959    # number of tentative 
     960    NB_ESSAI=3 
     961    # time delay between tentative 
     962    DELAI=2 
     963 
     964    i=0 
     965    while [ $i -lt $NB_ESSAI ] ; do 
     966      \cp -urL $1 $2 > out_rsync 2>&1 
     967      status=$? 
     968      if [ ${status} -gt 0 ]; then 
     969        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     970        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 
     971        sleep $DELAI 
     972      else 
     973        break 
     974      fi 
     975      (( i = i + 1 )) 
     976    done 
    932977 
    933978    if [ ${status} -gt 0 ] ; then 
     
    936981      IGCM_debug_Exit "IGCM_sys_Get_Master" 
    937982    else 
    938       rm out_rsync 
     983      \rm out_rsync 
    939984    fi 
    940985  else 
     
    943988  IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    944989} 
     990 
     991#==================================================== 
     992#- Call IGCM_sys_Mirror_libIGCM now ! 
     993if ( $MirrorlibIGCM ) ; then 
     994  IGCM_sys_Mirror_libIGCM 
     995fi 
    945996 
    946997#D-#================================================== 
     
    9661017      IGCM_sys_Chmod 444 ${1} 
    9671018    fi 
     1019    # 
     1020    # Only if we use rsync 
     1021    #IGCM_sys_MkdirArchive $( dirname $2 ) 
     1022    # 
     1023    #USUAL WAY 
     1024    \cp $1 $2 > out_rsync 2>&1 
     1025    status=$? 
     1026 
     1027#       #RSYNC WITH NETWORK SSH CALL 
     1028#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1029#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1030 
     1031#       #RSYNC WITH NFS USE 
     1032#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1033#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1034 
     1035#       status=$? 
     1036#       IGCM_sys_Rsync_out $status 
     1037 
     1038#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1039#       (( status=status+$? )) 
     1040 
     1041    if [ ${status} -gt 0 ] ; then 
     1042      echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
     1043      cat out_rsync 
     1044      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     1045    else 
     1046      \rm out_rsync 
     1047    fi 
     1048  else 
     1049    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1050  fi 
     1051  IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1052} 
     1053 
     1054#D-#================================================== 
     1055#D-function IGCM_sys_PutBuffer_Rest 
     1056#D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
     1057#D-           File and target directory must exist. 
     1058#D-* Examples: 
     1059#D- 
     1060function IGCM_sys_PutBuffer_Rest { 
     1061  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
     1062  if ( $DEBUG_sys ) ; then 
     1063    echo "IGCM_sys_PutBuffer_Rest :" $@ 
     1064  fi 
     1065  if [ $DRYRUN = 0 ]; then 
     1066    if [ ! -f ${1} ] ; then 
     1067      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
     1068      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1069    fi 
     1070 
     1071    typeset status 
     1072    # 
     1073    if [ X${JobType} = XRUN ] ; then 
     1074      IGCM_sys_Chmod 444 ${1} 
     1075    fi 
    9681076 
    9691077    # 
     
    9721080    status=$? 
    9731081 
    974 #       #RSYNC WITH NETWORK SSH CALL 
    975 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    976 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    977  
    978 #       #RSYNC WITH NFS USE 
    979 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    980 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    981  
    982 #       status=$? 
    983 #       IGCM_sys_Rsync_out $status 
    984  
    985 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    986 #       (( status=status+$? )) 
    987  
    988     if [ ${status} -gt 0 ] ; then 
    989       echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    990       cat out_rsync 
    991       IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    992     else 
    993       \rm out_rsync 
    994     fi 
    995   else 
    996     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    997   fi 
    998   IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
    999 } 
    1000  
    1001 #D-#================================================== 
    1002 #D-function IGCM_sys_PutBuffer_Rest 
    1003 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
    1004 #D-           File and target directory must exist. 
    1005 #D-* Examples: 
    1006 #D- 
    1007 function IGCM_sys_PutBuffer_Rest { 
    1008   IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
    1009   if ( $DEBUG_sys ) ; then 
    1010     echo "IGCM_sys_PutBuffer_Rest :" $@ 
    1011   fi 
    1012   if [ $DRYRUN = 0 ]; then 
    1013     if [ ! -f ${1} ] ; then 
    1014       echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
    1015       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
    1016     fi 
    1017  
    1018     typeset status 
    1019     # 
    1020     if [ X${JobType} = XRUN ] ; then 
    1021       IGCM_sys_Chmod 444 ${1} 
    1022     fi 
    1023  
    1024     # 
    1025     # USUAL WAY 
    1026     \cp $1 $2 > out_rsync 2>&1 
    1027     status=$? 
    1028  
    10291082    if [ ${status} -gt 0 ] ; then 
    10301083      echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 
     1084      [ -f ${2} ] && ls -l ${2} 
     1085      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    10311086      cat out_rsync 
    10321087      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     
    10611116    echo "IGCM_sys_Put_Out :" $@ 
    10621117  fi 
     1118 
     1119  typeset status 
     1120 
    10631121  if [ $DRYRUN = 0 ]; then 
    1064     if [ -f ${1} ] ; then 
    1065       if [ ! -d $( dirname $2 ) ] ; then 
    1066         IGCM_sys_MkdirArchive $( dirname $2 ) 
    1067       fi 
    1068     else 
     1122    if [ ! -f ${1} ] ; then 
    10691123      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 
    10701124      IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    10711125      return 1 
    10721126    fi 
    1073  
    1074     typeset status 
     1127    # 
     1128    IGCM_sys_MkdirArchive $( dirname $2 ) 
    10751129    # 
    10761130    if [ X${JobType} = XRUN ] ; then 
     
    10901144 
    10911145    if [ ${status} -gt 0 ] ; then 
    1092       echo "IGCM_sys_Put_Out : error." 
     1146      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}" 
    10931147      cat out_rsync 
    10941148      IGCM_debug_Exit "IGCM_sys_Put_Out" 
     
    11141168  fi 
    11151169 
    1116   typeset status 
     1170  typeset NB_ESSAI DELAI status i exist skip 
     1171 
     1172  # number of tentative 
     1173  NB_ESSAI=3 
     1174  # time delay between tentative 
     1175  DELAI=2 
    11171176 
    11181177  if [ $DRYRUN = 0 ]; then 
     
    11261185    # 
    11271186 
    1128     if [ X${JobType} = XRUN ] ; then 
    1129       if [ X${3} = X ] ; then 
    1130         IGCM_sys_Chmod 444 ${1} 
     1187    exist=false 
     1188    skip=false 
     1189    if [ -f $2 ] ; then 
     1190      IGCM_debug_Print 1 "$2 already exist" 
     1191      exist=true 
     1192      if [ "X$( diff $1 $2 )" = X ] ; then 
     1193        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 
     1194        status=0 
     1195        skip=true 
     1196      else 
     1197        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 
     1198        skip=false 
    11311199      fi 
    11321200    fi 
    11331201    # 
    1134     # USUAL WAY 
    1135     \cp $1 $2 > out_rsync 2>&1 
    1136     status=$? 
     1202    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 
     1203      IGCM_sys_Chmod u+w $2 
     1204    fi 
     1205 
     1206    if [ X${skip} = Xfalse ] ; then 
     1207      i=0 
     1208      while [ $i -lt $NB_ESSAI ] ; do 
     1209        # USUAL WAY 
     1210        \cp $1 $2 > out_rsync 2>&1 
     1211        status=$? 
     1212        if [ ${status} -gt 0 ]; then 
     1213          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1214          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 
     1215          [ -f ${2} ] && ls -l ${2} 
     1216          [ -f ${2}/${1} ] && ls -l ${2}/${1} 
     1217          sleep $DELAI 
     1218        else 
     1219          break 
     1220        fi 
     1221        (( i = i + 1 )) 
     1222      done 
     1223    fi 
    11371224 
    11381225    if [ ${status} -gt 0 ] ; then 
    11391226      echo "IGCM_sys_PutBuffer_Out : error." 
     1227      [ -f ${2} ] && ls -l ${2} 
     1228      [ -f ${2}/${1} ] && ls -l ${2}/${1} 
    11401229      cat out_rsync 
    11411230      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
    11421231    else 
     1232 
     1233      if [ X${JobType} = XRUN ] ; then 
     1234        if [ X${3} = X ] ; then 
     1235          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 
     1236          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 
     1237        fi 
     1238      fi 
     1239 
    11431240      \rm out_rsync 
    11441241    fi 
     
    11581255  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    11591256 
    1160   typeset DEST RET status dm_liste ifile target 
     1257  typeset DEST status dm_liste 
    11611258 
    11621259  if ( $DEBUG_sys ) ; then 
     
    11781275      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    11791276      IGCM_debug_Exit "IGCM_sys_Get" 
    1180       #return 
    1181     fi 
    1182  
    1183     (( RET=0 )) 
    1184     for target in ${dm_liste[*]} ; do 
    1185       \cp ${target} ${DEST} >> out_rsync 2>&1 
    1186       (( RET=RET+$? )) 
    1187     done 
    1188  
    1189 #       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 
    1190 #       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 
    1191 #       status=$? 
    1192 #       IGCM_sys_Rsync_out $status 
    1193  
    1194 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1195 #       (( RET=RET+$? )) 
    1196  
    1197     if [ ${RET} -gt 0 ] ; then 
    1198       echo "IGCM_sys_Get : error" 
     1277      return 
     1278    fi 
     1279 
     1280    #USUAL WAY 
     1281    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1 
     1282    status=$? 
     1283 
     1284    if [ ${status} -gt 0 ] ; then 
     1285      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" 
    11991286      cat out_rsync 
    1200       \rm out_rsync 
    12011287      IGCM_debug_Exit "IGCM_sys_Get" 
    12021288    else 
     
    12171303  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    12181304 
    1219   typeset DEST RET status buf_liste ifile target file_work 
     1305  typeset DEST buf_liste target file_work 
     1306  typeset NB_ESSAI DELAI status i 
    12201307 
    12211308  if ( $DEBUG_sys ) ; then 
    12221309    echo "IGCM_sys_GetBuffer :" $@ 
    12231310  fi 
     1311 
     1312  # number of tentative 
     1313  NB_ESSAI=3 
     1314  # time delay between tentative 
     1315  DELAI=2 
     1316 
    12241317  if [ $DRYRUN -le 2 ]; then 
    12251318    if [ X${1} = X'/l' ] ; then 
     
    12331326    #USUAL WAY 
    12341327    if [ X${1} = X'/l' ] ; then 
    1235       (( RET=0 )) 
    12361328      for target in ${buf_liste[*]} ; do 
    12371329        local_file=$( basename ${target} ) 
    1238         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1239         (( RET = RET + $? )) 
     1330        i=0 
     1331        while [ $i -lt $NB_ESSAI ] ; do 
     1332          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1333          status=$? 
     1334          if [ ${status} -gt 0 ]; then 
     1335            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1336            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1337            sleep $DELAI 
     1338          else 
     1339            break 
     1340          fi 
     1341          (( i = i + 1 )) 
     1342        done 
     1343        if [ ${status} -gt 0 ] ; then 
     1344          echo "IGCM_sys_Get : error" 
     1345          cat out_rsync 
     1346          \rm out_rsync 
     1347          IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1348        else 
     1349          \rm out_rsync 
     1350        fi 
    12401351      done 
    12411352    else 
    1242       \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
    1243       status=$? 
    1244     fi 
    1245  
    1246     if [ ${RET} -gt 0 ] ; then 
    1247       echo "IGCM_sys_GetBuffer : error" 
    1248       cat out_rsync 
    1249       \rm out_rsync 
    1250       IGCM_debug_Exit "IGCM_sys_GetBuffer" 
    1251     else 
    1252       \rm out_rsync 
     1353      i=0 
     1354      while [ $i -lt $NB_ESSAI ] ; do 
     1355        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1356        status=$? 
     1357        if [ ${status} -gt 0 ]; then 
     1358          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     1359          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." 
     1360          sleep $DELAI 
     1361        else 
     1362          break 
     1363        fi 
     1364        (( i = i + 1 )) 
     1365      done 
     1366      if [ ${status} -gt 0 ] ; then 
     1367        echo "IGCM_sys_Get : error" 
     1368        cat out_rsync 
     1369        \rm out_rsync 
     1370        IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1371      else 
     1372        \rm out_rsync 
     1373      fi 
    12531374    fi 
    12541375  else 
     
    13191440#D-#================================================== 
    13201441#D-function IGCM_sys_Put_Dods 
    1321 #D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 
     1442#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here 
    13221443#D-* Examples: 
    13231444#D- 
     
    13331454# REBUILD OPERATOR 
    13341455 
     1456#D-#================================================== 
     1457#D-function IGCM_sys_rebuild 
     1458#D-* Purpose: rebuild parallel files 
     1459#D-* Examples: 
     1460#D- 
    13351461function IGCM_sys_rebuild { 
    13361462  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     
    13391465  fi 
    13401466 
    1341   typeset status 
    1342  
    1343   /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 
    1344   status=$? 
     1467  typeset NB_ESSAI DELAI status i firstArg 
     1468  # number of tentative 
     1469  NB_ESSAI=3 
     1470  # time delay between tentative 
     1471  DELAI=2 
     1472 
     1473  i=0 
     1474  while [ $i -lt $NB_ESSAI ] ; do 
     1475    /home/users/igcmg/rebuild/bin/rebuild -f -o $@ > out_rsync 2>&1 
     1476    status=$? 
     1477    if [ ${status} -gt 0 ] ; then 
     1478      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1479      cat out_rsync 
     1480      \rm out_rsync 
     1481      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     1482      firstArg=${1} 
     1483      \rm ${firstArg} 
     1484      sleep $DELAI 
     1485    else 
     1486      \rm out_rsync 
     1487      break 
     1488    fi 
     1489    (( i = i + 1 )) 
     1490  done 
     1491 
    13451492  if [ ${status} -gt 0 ] ; then 
    1346     IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 
     1493    echo "IGCM_sys_rebuild : rebuild error code is ${status}" 
    13471494    IGCM_debug_Exit "rebuild" 
    13481495  fi 
     
    13511498} 
    13521499 
     1500#D-#================================================== 
     1501#D-function IGCM_sys_rebuild_station 
     1502#D-* Purpose: rebuild parallel files describing station  
     1503#D-* Examples: 
     1504#D- 
    13531505function IGCM_sys_rebuild_station { 
    13541506  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ 
     
    14451597# Activate Running Environnment Variables 
    14461598 
     1599#D-#================================================== 
     1600#D-function IGCM_sys_desactiv_variables 
     1601#D-* Purpose: set environement variables prior to execution 
     1602#D-* Examples: 
     1603#D- 
    14471604function IGCM_sys_activ_variables { 
    14481605  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     
    14501607    echo "IGCM_sys_activ_variables" 
    14511608  fi 
     1609 
     1610# -------------------------------------------------------------------- 
     1611#D- MPI specifications 
     1612# -------------------------------------------------------------------- 
     1613 
     1614# -------------------------------------------------------------------- 
     1615#D- Other specifications 
     1616# -------------------------------------------------------------------- 
     1617 
    14521618  IGCM_debug_PopStack "IGCM_sys_activ_variables" 
    14531619} 
     
    14561622# Desactivate Running Environnment Variables 
    14571623 
     1624#D-#================================================== 
     1625#D-function IGCM_sys_desactiv_variables 
     1626#D-* Purpose: unset environement variables after execution 
     1627#D-* Examples: 
     1628#D- 
    14581629function IGCM_sys_desactiv_variables { 
    14591630  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
     
    14611632    echo "IGCM_sys_desactiv_variables" 
    14621633  fi 
     1634# -------------------------------------------------------------------- 
     1635#D- MPI specifications 
     1636# -------------------------------------------------------------------- 
     1637 
     1638# -------------------------------------------------------------------- 
     1639#D- Other specifications 
     1640# -------------------------------------------------------------------- 
     1641 
    14631642  IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
    14641643} 
     
    14671646# Build MPI/OMP scripts run file (dummy function) 
    14681647 
     1648#D-#================================================== 
     1649#D-function IGCM_sys_build_run_file 
     1650#D-* Purpose: build run file (deprecated) 
     1651#D-* Examples: 
     1652#D- 
    14691653function IGCM_sys_build_run_file { 
    14701654 
     
    14751659############################################################ 
    14761660# Build MPI/OMP scripts 
     1661 
     1662#D-#================================================== 
     1663#D-function IGCM_sys_build_execution_scripts 
     1664#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} 
     1665#D-* Examples: 
     1666#D- 
    14771667function IGCM_sys_build_execution_scripts 
    14781668{ 
     
    14861676 
    14871677  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
    1488     IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1678    IGCM_debug_Exit "IGCM_sys_obelix build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
    14891679  fi 
    14901680 
     
    16751865      done 
    16761866 
    1677         # Then second loop on the components 
     1867      # Then second loop on the components 
    16781868 
    16791869      for comp in ${config_ListOfComponents[*]} ; do 
     
    17271917  fi 
    17281918 
    1729   IGCM_debug_Print 1 "sys Obelix : La commande d execution est " 
    1730   IGCM_debug_Print 1 $EXECUTION 
     1919  IGCM_debug_Print 1 "sys Obelix : execution command is" 
     1920  IGCM_debug_Print 1 "$EXECUTION" 
    17311921 
    17321922  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     
    17341924 
    17351925############################################################ 
    1736 # Check of space available on temporary filesytems 
     1926# Check of space available on temporary filesytems. Dummy function here 
     1927 
     1928#D-#================================================== 
     1929#D-function IGCM_sys_check_quota. Dummy call here 
     1930#D-* Purpose: check user quota. Stop the simulation if quota above 90% 
     1931#D-* Examples: 
     1932#D- 
    17371933function IGCM_sys_check_quota { 
    17381934  IGCM_debug_PushStack "IGCM_sys_check_quota" 
     
    17431939} 
    17441940 
     1941#D-#================================================== 
     1942#D-function IGCM_sys_CountJobInQueue 
     1943#D-* Purpose: Check if job_name is currently 
     1944#D-  running or in queue 
     1945#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun 
     1946#D- 
     1947function IGCM_sys_CountJobInQueue { 
     1948  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" 
     1949  if ( $DEBUG_sys ) ; then 
     1950    echo "IGCM_sys_CountJobInQueue" 
     1951  fi 
     1952  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" 
     1953} 
     1954 
    17451955############################################################## 
    17461956# NCO OPERATOR 
    17471957 
     1958#D-#================================================== 
     1959#D-function IGCM_sys_ncap2 
     1960#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry 
     1961#D-* Examples: 
     1962#D- 
    17481963function IGCM_sys_ncap2 { 
    17491964  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     
    17761991 
    17771992  if [ ${status} -gt 0 ] ; then 
    1778       echo "IGCM_sys_ncap2 : ncap2 error" 
    1779       IGCM_debug_Exit "ncap2" 
     1993    echo "IGCM_sys_ncap2 : ncap2 error" 
     1994    IGCM_debug_Exit "ncap2" 
    17801995  fi 
    17811996 
     
    17831998} 
    17841999 
     2000#D-#================================================== 
     2001#D-function IGCM_sys_ncatted 
     2002#D-* Purpose: encapsulate ncatted call so as to manage error code and retry 
     2003#D-* Examples: 
     2004#D- 
    17852005function IGCM_sys_ncatted { 
    17862006  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     
    18132033 
    18142034  if [ ${status} -gt 0 ] ; then 
    1815       echo "IGCM_sys_ncatted : ncatted error" 
    1816       IGCM_debug_Exit "ncatted" 
     2035    echo "IGCM_sys_ncatted : ncatted error" 
     2036    IGCM_debug_Exit "ncatted" 
    18172037  fi 
    18182038 
     
    18202040} 
    18212041 
     2042#D-#================================================== 
     2043#D-function IGCM_sys_ncbo 
     2044#D-* Purpose: encapsulate ncbo call so as to manage error code and retry 
     2045#D-* Examples: 
     2046#D- 
    18222047function IGCM_sys_ncbo { 
    18232048  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     
    18502075 
    18512076  if [ ${status} -gt 0 ] ; then 
    1852       echo "IGCM_sys_ncbo : ncbo error" 
    1853       IGCM_debug_Exit "ncbo" 
     2077    echo "IGCM_sys_ncbo : ncbo error" 
     2078    IGCM_debug_Exit "ncbo" 
    18542079  fi 
    18552080 
     
    18572082} 
    18582083 
     2084#D-#================================================== 
     2085#D-function IGCM_sys_ncdif 
     2086#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry 
     2087#D-* Examples: 
     2088#D- 
    18592089function IGCM_sys_ncdiff { 
    18602090  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     
    18872117 
    18882118  if [ ${status} -gt 0 ] ; then 
    1889       echo "IGCM_sys_ncdiff : ncdiff error" 
    1890       IGCM_debug_Exit "ncdiff" 
     2119    echo "IGCM_sys_ncdiff : ncdiff error" 
     2120    IGCM_debug_Exit "ncdiff" 
    18912121  fi 
    18922122 
     
    18942124} 
    18952125 
     2126#D-#================================================== 
     2127#D-function IGCM_sys_ncea 
     2128#D-* Purpose: encapsulate ncea call so as to manage error code and retry 
     2129#D-* Examples: 
     2130#D- 
    18962131function IGCM_sys_ncea { 
    18972132  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     
    19242159 
    19252160  if [ ${status} -gt 0 ] ; then 
    1926       echo "IGCM_sys_ncea : ncea error" 
    1927       IGCM_debug_Exit "ncea" 
     2161    echo "IGCM_sys_ncea : ncea error" 
     2162    IGCM_debug_Exit "ncea" 
    19282163  fi 
    19292164 
     
    19312166} 
    19322167 
     2168#D-#================================================== 
     2169#D-function IGCM_sys_ncecat 
     2170#D-* Purpose: encapsulate ncecat call so as to manage error code and retry 
     2171#D-* Examples: 
     2172#D- 
    19332173function IGCM_sys_ncecat { 
    19342174  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     
    19612201 
    19622202  if [ ${status} -gt 0 ] ; then 
    1963       echo "IGCM_sys_ncecat : ncecat error" 
    1964       IGCM_debug_Exit "ncecat" 
     2203    echo "IGCM_sys_ncecat : ncecat error" 
     2204    IGCM_debug_Exit "ncecat" 
    19652205  fi 
    19662206 
     
    19682208} 
    19692209 
     2210#D-#================================================== 
     2211#D-function IGCM_sys_ncflint 
     2212#D-* Purpose: encapsulate ncflint call so as to manage error code and retry 
     2213#D-* Examples: 
     2214#D- 
    19702215function IGCM_sys_ncflint { 
    19712216  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     
    19982243 
    19992244  if [ ${status} -gt 0 ] ; then 
    2000       echo "IGCM_sys_ncflint : ncflint error" 
    2001       IGCM_debug_Exit "ncflint" 
     2245    echo "IGCM_sys_ncflint : ncflint error" 
     2246    IGCM_debug_Exit "ncflint" 
    20022247  fi 
    20032248 
     
    20052250} 
    20062251 
     2252#D-#================================================== 
     2253#D-function IGCM_sys_ncks 
     2254#D-* Purpose: encapsulate ncks call so as to manage error code and retry 
     2255#D-* Examples: 
     2256#D- 
    20072257function IGCM_sys_ncks { 
    20082258  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     
    20352285 
    20362286  if [ ${status} -gt 0 ] ; then 
    2037       echo "IGCM_sys_ncks : ncks error" 
    2038       IGCM_debug_Exit "ncks" 
     2287    echo "IGCM_sys_ncks : ncks error" 
     2288    IGCM_debug_Exit "ncks" 
    20392289  fi 
    20402290 
     
    20422292} 
    20432293 
     2294#D-#================================================== 
     2295#D-function IGCM_sys_ncpdq 
     2296#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry 
     2297#D-* Examples: 
     2298#D- 
    20442299function IGCM_sys_ncpdq { 
    20452300  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     
    20722327 
    20732328  if [ ${status} -gt 0 ] ; then 
    2074       echo "IGCM_sys_ncpdq : ncpdq error" 
    2075       IGCM_debug_Exit "ncpdq" 
     2329    echo "IGCM_sys_ncpdq : ncpdq error" 
     2330    IGCM_debug_Exit "ncpdq" 
    20762331  fi 
    20772332 
     
    20792334} 
    20802335 
     2336#D-#================================================== 
     2337#D-function IGCM_sys_ncra 
     2338#D-* Purpose: encapsulate ncra call so as to manage error code and retry 
     2339#D-* Examples: 
     2340#D- 
    20812341function IGCM_sys_ncra { 
    20822342  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     
    21092369 
    21102370  if [ ${status} -gt 0 ] ; then 
    2111       echo "IGCM_sys_ncra : ncra error" 
    2112       IGCM_debug_Exit "ncra" 
     2371    echo "IGCM_sys_ncra : ncra error" 
     2372    IGCM_debug_Exit "ncra" 
    21132373  fi 
    21142374 
     
    21162376} 
    21172377 
     2378#D-#================================================== 
     2379#D-function IGCM_sys_ncrcat 
     2380#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry 
     2381#D-* Examples: 
     2382#D- 
    21182383function IGCM_sys_ncrcat { 
    21192384  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     
    21222387  fi 
    21232388 
    2124   typeset NB_ESSAI DELAI status i 
     2389  typeset NB_ESSAI DELAI status i lastArg 
    21252390  # number of tentative 
    21262391  NB_ESSAI=3 
     
    21382403      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
    21392404      sleep $DELAI 
     2405    elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" out_rsync )" = "X" ] ; then 
     2406      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" 
     2407      cat out_rsync 
     2408      # remove files having corrupted time axis 
     2409      eval lastArg=\${$#} 
     2410      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" 
     2411      \rm ${lastArg} 
     2412      \rm out_rsync 
     2413      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 
     2414      sleep $DELAI 
    21402415    else 
    21412416      \rm out_rsync 
     
    21462421 
    21472422  if [ ${status} -gt 0 ] ; then 
    2148       echo "IGCM_sys_ncrcat : ncrcat error" 
    2149       #IGCM_debug_Exit "ncrcat" 
     2423    echo "IGCM_sys_ncrcat : ncrcat error" 
     2424    #IGCM_debug_Exit "ncrcat" 
    21502425  fi 
    21512426 
     
    21532428} 
    21542429 
     2430#D-#================================================== 
     2431#D-function IGCM_sys_ncrename 
     2432#D-* Purpose: encapsulate ncrename call so as to manage error code and retry 
     2433#D-* Examples: 
     2434#D- 
    21552435function IGCM_sys_ncrename { 
    21562436  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     
    21832463 
    21842464  if [ ${status} -gt 0 ] ; then 
    2185       echo "IGCM_sys_ncrename : ncrename error" 
    2186       IGCM_debug_Exit "ncrename" 
     2465    echo "IGCM_sys_ncrename : ncrename error" 
     2466    IGCM_debug_Exit "ncrename" 
    21872467  fi 
    21882468 
     
    21902470} 
    21912471 
     2472#D-#================================================== 
     2473#D-function IGCM_sys_ncwa 
     2474#D-* Purpose: encapsulate ncwa call so as to manage error code and retry 
     2475#D-* Examples: 
     2476#D- 
    21922477function IGCM_sys_ncwa { 
    21932478  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     
    22202505 
    22212506  if [ ${status} -gt 0 ] ; then 
    2222       echo "IGCM_sys_ncwa : ncwa error" 
    2223       IGCM_debug_Exit "ncwa" 
     2507    echo "IGCM_sys_ncwa : ncwa error" 
     2508    IGCM_debug_Exit "ncwa" 
    22242509  fi 
    22252510 
     
    22302515# CDO OPERATOR 
    22312516 
     2517#D-#================================================== 
     2518#D-function IGCM_sys_cdo 
     2519#D-* Purpose: encapsulate cdo call so as to manage error code and retry 
     2520#D-* Examples: 
     2521#D- 
    22322522function IGCM_sys_cdo { 
    22332523  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
Note: See TracChangeset for help on using the changeset viewer.