Changeset 762


Ignore:
Timestamp:
12/13/12 14:54:44 (12 years ago)
Author:
labetoulle
Message:

RunChecker? :

  • Bugfix in -p option processing ;
  • Do not search for post-treatment jobs if job is "Waiting"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_RunChecker

    r761 r762  
    3131  fg_new=false 
    3232 
    33   NbOcc=$( awk -v JobName=${JobName} \ 
    34            'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} ) 
     33  if [ ! X${JobName} == X ] ; then 
     34    NbOcc=$( awk -v JobName=${JobName} \ 
     35             'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} ) 
     36  else 
     37    NbOcc=0 
     38  fi 
    3539 
    3640  if ( [ ${NbOcc} -eq 0 ] && ( $fg_path ) ) ; then 
     
    163167    printf "| JobName = ${ColExp}%-${#JobName}s${ColNon}" ${JobName} 
    164168    printf "%-${len}s" ${Dum}  
    165     printf "run.card : ${ColExp}%-17s${ColNon}|\n" "${LastWrite} " 
     169    printf "run.card : ${ColExp}%-18s${ColNon}|\n" "${LastWrite}" 
    166170    echo "|-------------------------|-------------|-------------------------|-------------|-----:----------:----------|" 
    167171    echo "|                         |             |                         |             |     Pending Rebuilds      |" 
     
    199203    fi 
    200204 
    201     printf "|-----------------------------------------------------------------------------------------------------------|\n" 
    202     printf "|                                                      Last                                                 |\n" 
    203     printf "|     Rebuild      |   Pack_Output    |   Pack_Restart   |    Pack_Debug    |  Monitoring  |     Atlas      |\n" 
    204     printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n" 
     205    if [ ${NbLines} -gt 0 ] ; then 
     206      printf "|-----------------------------------------------------------------------------------------------------------|\n" 
     207      printf "|                                                      Last                                                 |\n" 
     208      printf "|     Rebuild      |   Pack_Output    |   Pack_Restart   |    Pack_Debug    |  Monitoring  |     Atlas      |\n" 
     209      printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n" 
     210    fi 
    205211 
    206212    return 
     
    292298  case $1 in 
    293299    -h|--help|-help) 
    294       echo "usage: $0 [-u user] [-n] [-q] [-j n] job_name" 
    295       echo "       $0 [-u user] [-n] [-q] [-j n] -p config.card_path" 
     300      echo "usage: $0 [-u user] [-q] [-j n] [-s] job_name" 
     301      echo "       $0 [-u user] [-q] [-j n] -p config.card_path" 
    296302      echo "" 
    297303      echo "options :" 
     
    302308      echo "  -s : search for a new job in \$WORKDIR and fill in " 
    303309      echo "       the catalog before printing information" 
    304       echo "  -p : give the config.card path to a new simulation, " 
    305       echo "       instead of the job name." 
     310      echo "  -p : give the directory (absolute path) containing " 
     311      echo "       the config.card instead of the job name." 
    306312      exit ;; 
    307313#    -b|-nocolor) 
    308314#      fg_color=false 
    309315#      shift 1 ;; 
    310     -s|-search) 
    311       fg_search=true 
    312       shift 1 ;; 
    313     -q|-quiet) 
    314       fg_quiet=true 
    315       shift 1 ;; 
     316    -j|-job-number) 
     317      NbHisto="$2" 
     318      shift 2 ;; 
    316319    -p|-config-path) 
    317320      ConfigPath="$2" 
    318321      fg_path=true 
    319322      shift 2 ;; 
    320     -j|-job-number) 
    321       NbHisto="$2" 
    322       shift 2 ;; 
     323    -q|-quiet) 
     324      fg_quiet=true 
     325      shift 1 ;; 
     326    -s|-search) 
     327      fg_search=true 
     328      shift 1 ;; 
    323329    -u|-user) 
    324330      TargetUsr="$2" 
     
    418424  SpaceName=${config_UserChoices_SpaceName} 
    419425 
    420   IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod 
    421   CumulPeriod=${run_Configuration_CumulPeriod} 
    422426 
    423427  if ( [ ! X${PeriodState} == XWaiting ] && [ ! X${PeriodState} == XCompleted ] ) ; then 
    424428    IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateBegin 
    425429    IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateEnd 
     430  IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod 
    426431    PeriodDateBegin=${run_Configuration_PeriodDateBegin} 
    427432    PeriodDateEnd=${run_Configuration_PeriodDateEnd} 
     433    CumulPeriod=${run_Configuration_CumulPeriod} 
    428434  else 
    429435    PeriodDateBegin="." 
    430436    PeriodDateEnd="." 
     437    CumulPeriod="." 
    431438  fi 
    432439 
     
    479486 
    480487 
    481   # Check last REBUILD and PACK* jobs 
    482   # ================================= 
    483   # Define input parameters 
    484   # ----------------------- 
    485   set -A JobType_list "${RebuildJob}" "pack_output" "pack_restart" "pack_debug" 
    486  
    487   for JobType in ${JobType_list[*]} ; do  
    488     typeset    name1="${JobType}_String" 
    489     typeset    name2="${JobType}_Field" 
    490     if [ X${JobType} == X${RebuildJob} ] ; then 
    491       eval ${name1}=IGCM_sys_PutBuffer_Out 
    492       eval ${name2}=4 
    493     else 
    494       eval ${name1}=IGCM_sys_Put_Out 
    495       eval ${name2}=3 
    496     fi 
    497   done 
    498  
    499   # Check jobs 
    500   # ---------- 
    501   NbLines=0 
    502   for JobType in ${JobType_list[*]} ; do  
    503     eval String=\${${JobType}_String} 
    504     eval Field=\${${JobType}_Field} 
    505  
    506     set -A FileList $( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} ) 
    507  
    508     if [ ${#FileList[*]} -gt ${NbLines} ] ; then 
    509       NbLines=${#FileList[*]} 
    510     fi 
    511  
    512     (( ind = 0 )) 
    513     for FileName in ${FileList[*]} ; do 
    514       LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' ) 
    515  
    516       Error=$( awk -v String=${String} \ 
    517                    'BEGIN { x=0 } ($1~String) && ($3~"error.") { x=x+1 } END { print x }' \ 
    518                    ${POST_DIR}/${JobType}.${LastDate}.out ) 
    519  
    520       Match=$( awk -v String=${String} \ 
    521                    'BEGIN { x=0 } ($1~String) && ($3!~"error.") { x=x+1 } END { print x }' \ 
    522                    ${POST_DIR}/${JobType}.${LastDate}.out ) 
    523       (( Nb = ${Match} - ${Error} )) 
    524  
    525       if ( [ ${Error} -eq 0 ] && [ ${Nb} -gt 0 ] ) ; then 
    526         Status=OK 
     488  if [ $PeriodState != "Waiting" ] ; then 
     489 
     490    # Check last REBUILD and PACK* jobs 
     491    # ================================= 
     492    # Define input parameters 
     493    # ----------------------- 
     494    set -A JobType_list "${RebuildJob}" "pack_output" "pack_restart" "pack_debug" 
     495 
     496    for JobType in ${JobType_list[*]} ; do  
     497      typeset    name1="${JobType}_String" 
     498      typeset    name2="${JobType}_Field" 
     499      if [ X${JobType} == X${RebuildJob} ] ; then 
     500        eval ${name1}=IGCM_sys_PutBuffer_Out 
     501        eval ${name2}=4 
    527502      else 
    528         Status=KO 
     503        eval ${name1}=IGCM_sys_Put_Out 
     504        eval ${name2}=3 
    529505      fi 
    530  
    531       eval ${JobType}_Date[$ind]=${LastDate} 
    532       eval ${JobType}_Status[$ind]=${Status} 
    533       eval ${JobType}_Nb[$ind]=${Nb} 
    534        
    535       (( ind = ind + 1 )) 
    536506    done 
    537   done 
    538  
    539   # Check last MONITORING jobs 
    540   # ========================== 
    541   JobType=monitoring 
    542   if [ -d ${CWORK_DIR}/MONITORING ] ; then 
    543     LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \ 
    544                     awk '{ print $NF }' ) 
    545     eval ${JobType}_Date=${LastDate} 
    546   fi 
    547  
    548   # Check last ATLAS jobs 
    549   # ===================== 
    550   JobType=atlas 
    551   if [ -d ${CWORK_DIR}/ATLAS ] ; then 
    552     set -A FileList $( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} ) 
    553  
    554     if [ ${#FileList[*]} -gt ${NbLines} ] ; then 
    555       NbLines=${#FileList[*]} 
    556     fi 
    557  
    558     (( ind = 0 )) 
    559     for FileName in ${FileList[*]} ; do 
    560       eval ${JobType}_Date[$ind]=${FileName} 
    561       (( ind = ind + 1 )) 
     507 
     508    # Check jobs 
     509    # ---------- 
     510    NbLines=0 
     511    for JobType in ${JobType_list[*]} ; do  
     512      eval String=\${${JobType}_String} 
     513      eval Field=\${${JobType}_Field} 
     514 
     515      set -A FileList $( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} ) 
     516 
     517      if [ ${#FileList[*]} -gt ${NbLines} ] ; then 
     518        NbLines=${#FileList[*]} 
     519      fi 
     520 
     521      (( ind = 0 )) 
     522      for FileName in ${FileList[*]} ; do 
     523        LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' ) 
     524 
     525        Error=$( awk -v String=${String} \ 
     526                     'BEGIN { x=0 } ($1~String) && ($3~"error.") { x=x+1 } END { print x }' \ 
     527                     ${POST_DIR}/${JobType}.${LastDate}.out ) 
     528 
     529        Match=$( awk -v String=${String} \ 
     530                     'BEGIN { x=0 } ($1~String) && ($3!~"error.") { x=x+1 } END { print x }' \ 
     531                     ${POST_DIR}/${JobType}.${LastDate}.out ) 
     532        (( Nb = ${Match} - ${Error} )) 
     533 
     534        if ( [ ${Error} -eq 0 ] && [ ${Nb} -gt 0 ] ) ; then 
     535          Status=OK 
     536        else 
     537          Status=KO 
     538        fi 
     539 
     540        eval ${JobType}_Date[$ind]=${LastDate} 
     541        eval ${JobType}_Status[$ind]=${Status} 
     542        eval ${JobType}_Nb[$ind]=${Nb} 
     543         
     544        (( ind = ind + 1 )) 
     545      done 
    562546    done 
    563   fi 
    564  
    565  
    566   # Time of last write on run.card 
    567   # ============================== 
    568   LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | awk '{print $6 " " $7}' ) 
     547 
     548    # Check last MONITORING jobs 
     549    # ========================== 
     550    JobType=monitoring 
     551    if [ -d ${CWORK_DIR}/MONITORING ] ; then 
     552      LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \ 
     553                      awk '{ print $NF }' ) 
     554      eval ${JobType}_Date=${LastDate} 
     555    fi 
     556 
     557    # Check last ATLAS jobs 
     558    # ===================== 
     559    JobType=atlas 
     560    if [ -d ${CWORK_DIR}/ATLAS ] ; then 
     561      set -A FileList $( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} ) 
     562 
     563      if [ ${#FileList[*]} -gt ${NbLines} ] ; then 
     564        NbLines=${#FileList[*]} 
     565      fi 
     566 
     567      (( ind = 0 )) 
     568      for FileName in ${FileList[*]} ; do 
     569        eval ${JobType}_Date[$ind]=${FileName} 
     570        (( ind = ind + 1 )) 
     571      done 
     572    fi 
     573 
     574 
     575    # Time of last write on run.card 
     576    # ============================== 
     577    LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | awk '{print $6 " " $7}' ) 
     578 
     579  else 
     580 
     581    NbLines=0 
     582 
     583  fi 
    569584     
    570585 
Note: See TracChangeset for help on using the changeset viewer.