Ignore:
Timestamp:
08/20/13 12:44:26 (11 years ago)
Author:
sdipsl
Message:

Add instrumentation for IGCM_sys_ncrcat IGCM_sys_ncecat IGCM_sys_ncra IGCM_sys_ncks IGCM_sys_cdo see #140
stack files handling : one stack file per TaskType? : computing.stack, post-processsing, checking.stack

Location:
trunk/libIGCM/libIGCM_debug
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/IGCM_debug_Test.ksh

    r373 r926  
    1919#================================================= 
    2020libIGCM=`dirname $0`/.. 
     21typeset TaskType=checking 
    2122. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh 
    2223 
     
    4748 
    4849IGCM_debug_PrintVariables 1 Option 
    49  
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r925 r926  
    3131typeset RandomError=false 
    3232 
    33 # Where the stack file containing call tree will be stored. 
    34 typeset StackFileLocation=${StackFileLocation:=${PWD}} 
    35  
     33# Stack file containing call tree will be stored there. 
    3634if ( $DEBUG_debug ) ; then 
    37   if [ -f ${StackFileLocation}/stack ] ; 
     35  if [ X${TaskType} = Xcomputing ]; then 
     36    typeset StackFileLocation=${StackFileLocation:=${PWD}} 
     37    typeset StackFileName=computing.stack.$$ 
     38  elif [ X${TaskType} = Xpost-processing ]; then 
     39    typeset StackFileLocation=${POST_DIR:=${StackFileLocation}} 
     40    typeset StackFileName=post-processing.stack.$$ 
     41  elif [ X${TaskType} = Xchecking ]; then 
     42    typeset StackFileLocation=${POST_DIR:=${PWD}} 
     43    typeset StackFileName=checking.stack.$$ 
     44  fi 
     45  if [ -f ${StackFileLocation}/${StackFileName} ] ; 
    3846  then 
    39     echo "Stack of an libIGCM job :" >> ${StackFileLocation}/stack 
     47    echo "Stack of an libIGCM job :" >> ${StackFileLocation}/${StackFileName} 
    4048  else 
    41     echo "Stack of an libIGCM job :" >  ${StackFileLocation}/stack 
     49    echo "Stack of an libIGCM job :" >  ${StackFileLocation}/${StackFileName} 
    4250  fi 
    4351fi 
     
    7381function IGCM_debug_getDate_ms 
    7482{ 
    75   typeset nanosecs testnum 
     83  typeset nanosecs ms 
    7684  # nano secondes since 01-jan-1970 
    7785  nanosecs=$( date +%s%N ) 
     
    119127      iEntity=${destination} 
    120128    fi 
    121     sizeKo=$( du --apparent-size -k ${iEntity} | awk {'print $1'} ) 
     129    sizeKo=$( du --apparent-size -sk ${iEntity} | awk {'print $1'} ) 
    122130    sumSizeKo=$(( $sumSizeKo + $sizeKo )) 
    123131  done 
    124132  sumSizeMo=$( echo "scale=6;${sumSizeKo}/1024" | bc ) 
    125133  echo "${sumSizeKo}|${sumSizeMo}" 
     134 
    126135} 
    127136 
     
    149158  decal=0 
    150159  while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 
    151     printf ' ' >> ${StackFileLocation}/stack 
     160    printf ' ' >> ${StackFileLocation}/${StackFileName} 
    152161    (( decal = decal + 1 )) 
    153162  done 
    154163  # Log to stack file 
    155   echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b "${Body}"      >> ${StackFileLocation}/stack 
     164  echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b "${Body}"      >> ${StackFileLocation}/${StackFileName} 
    156165 
    157166  # Log separately AMQP send message command 
     
    196205  if ( $DEBUG_debug ) ; then 
    197206    typeset decal inputs startTime_ms 
    198     echo >> ${StackFileLocation}/stack 
    199207 
    200208    # Only cosmetics : stack file 
     209    echo >> ${StackFileLocation}/${StackFileName} 
    201210    decal=0 
    202211    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 
    203       printf ' ' >> ${StackFileLocation}/stack 
     212      printf ' ' >> ${StackFileLocation}/${StackFileName} 
    204213      (( decal = decal + 1 )) 
    205214    done 
     215 
     216    # Fill the stack file 
     217    echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName} 
    206218 
    207219    # Save input list in an indexed array 
     
    224236      IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /,/g" ) 
    225237    fi 
    226  
    227     # Fill the stack file 
    228     echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack 
    229238 
    230239    if [ X${ActivateBigBro} = Xtrue ] ; then 
     
    250259function IGCM_debug_PopStack { 
    251260  if ( $DEBUG_debug ) ; then 
    252     typeset decal command arguments startTime_ms endTime_ms 
    253     typeset instrumentation source dest 
     261    typeset i decal command arguments startTime_ms endTime_ms 
     262    typeset instrumentation dest 
     263    # they are not typeset because they are send "by adress" to son functions 
     264    # we unset them to avoid "memory effect" 
     265    unset fileList source 
    254266 
    255267    # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR 
     
    259271      if [ $((RANDOM%10000)) -le 10 ] ; then 
    260272        IGCM_debug_Print 1 "Random error has been triggered" 
    261         echo "RANDOM ERROR" >> ${StackFileLocation}/stack 
     273        echo "RANDOM ERROR" >> ${StackFileLocation}/${StackFileName} 
    262274        ExitFlag=true 
    263275      fi 
     
    362374      entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) 
    363375      ;; 
     376     
     377    # NCO commands 
     378    IGCM_sys_ncrcat|IGCM_sys_ncecat|IGCM_sys_ncra|IGCM_sys_ncks|IGCM_sys_cdo) 
     379      # Example of what we want to catch : only filenames in those command lines 
     380      # IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE} 
     381      # IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${file1} ${liste_file_tmp[*]} ${file_out} 
     382      # IGCM_sys_ncrcat -p ${dir} ${liste_file_tmp} --output ${output} 
     383      # IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output} 
     384      instrumentation=true 
     385      # All files that are not the latest argument (only input files) 
     386      i=0 
     387      keepGoing=true 
     388      while ( ${keepGoing} ) ; do 
     389        if [ -f ${arguments[${#arguments[*]}-2-${i}]} ] ; then 
     390          fileList="${fileList} ${arguments[${#arguments[*]}-2-${i}]}" 
     391          ((i = i + 1)) 
     392        elif [ ${i} -ge 1 ] ; then 
     393          keepGoing=false 
     394        else 
     395          ((i = i + 1)) 
     396        fi 
     397      done 
     398      # i value is at least 1 
     399      # just need one file to get the directory 
     400      source=${arguments[${#arguments[*]}-1-${i}]} 
     401      # Nothing but the latest 
     402      dest=${arguments[${#arguments[*]}-1]} 
     403      # Size of file whose name are stored in a list 
     404      entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) 
     405      ;; 
    364406    esac 
    365407 
     
    370412    decal=0 
    371413    while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do 
    372       printf ' ' >> ${StackFileLocation}/stack 
     414      printf ' ' >> ${StackFileLocation}/${StackFileName} 
    373415      (( decal = decal + 1 )) 
    374416    done 
     
    376418    if ( ${ExitFlag} ) ; then 
    377419      # Inform the stack file 
    378       echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/stack 
     420      echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/${StackFileName} 
    379421 
    380422      if [ X${ActivateBigBro} = Xtrue ] ; then 
     
    388430    else 
    389431      # Inform the stack file 
    390       echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/stack 
     432      echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName} 
    391433      if [ X${ActivateBigBro} = Xtrue ] ; then 
    392434        # RabbitMQ message code 
     
    652694 
    653695  #--------------------- 
    654   ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1 
     696  ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > /tmp/IGCM_debug_Test.ref.failed 2>&1 
    655697  sleep 2 
    656698 
    657699  # Remove date stamp. 
    658   sed -e "s:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]\:[0-9][0-9]\:[0-9][0-9] ::g" IGCM_debug_Test.ref.failed > IGCM_debug_Test.ref.failed.nodate 
    659   mv IGCM_debug_Test.ref.failed.nodate IGCM_debug_Test.ref.failed 
    660  
    661   if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then 
     700  sed -e "s:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]\:[0-9][0-9]\:[0-9][0-9] ::g" /tmp/IGCM_debug_Test.ref.failed > /tmp/IGCM_debug_Test.ref.failed.nodate 
     701  mv /tmp/IGCM_debug_Test.ref.failed.nodate /tmp/IGCM_debug_Test.ref.failed 
     702 
     703  if diff /tmp/IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then 
    662704    echo "Check libIGCM_debug ..............................................[ OK ]" 
    663     rm -f IGCM_debug_Test.ref.failed 
     705    rm -f /tmp/IGCM_debug_Test.ref.failed 
    664706  else 
    665707    echo "Check libIGCM_debug ..........................................[ FAILED ]" 
     
    669711    echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref" 
    670712    echo "           Report errors to the author: Patrick.Brockmann@cea.fr" 
     713    cat /tmp/IGCM_debug_Test.ref.failed 
    671714    exit 4 
    672715  fi 
Note: See TracChangeset for help on using the changeset viewer.