Changeset 756


Ignore:
Timestamp:
12/07/12 17:00:54 (12 years ago)
Author:
labetoulle
Message:

RunChecker? : bugfix in search procedure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_RunChecker

    r755 r756  
    2929  unset SUBMIT_DIR 
    3030 
    31   if ( $fg_path ) ; then 
    32     set -A FileList 
    33     FileList=$( ls ${ConfigPath}/Job_* ) 
     31  fg_new=false 
     32 
     33  NbOcc=$( awk -v JobName=${JobName} \ 
     34           'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} ) 
     35 
     36  if ( [ ${NbOcc} -eq 0 ] && ( $fg_path ) ) ; then 
     37    set -A FileList $( ls ${ConfigPath}/Job_* ) 
    3438    if [ X$FileList == X ] ; then 
    3539      NbOcc=0 
     
    3842      fg_new=true 
    3943    fi 
    40   else 
    41     NbOcc=$( awk -v JobName=${JobName} \ 
    42              'BEGIN {x=0}  $1 ~ JobName {++x} END {print x}' ${SimuCatalog} ) 
    43   fi 
    44  
    45   if ( [ ${NbOcc} -eq 0 ] && ( ${fg_new} ) ) ; then 
     44  fi 
     45 
     46  if ( [ ${NbOcc} -eq 0 ] && ( ${fg_search} ) ) ; then 
    4647    SEARCH_DIR=${WORKDIR} 
    4748    if [ ${TargetUsr} != ${CurrentUsr} ] ; then 
     
    5051    echo "${JobName} not in Catalog, we'll try to find it in ${SEARCH_DIR}" 
    5152 
    52     set -A FileList 
    53     FileList=$( find ${SEARCH_DIR}/ -name "Job_${JobName}" ) 
     53    set -A FileList $( find ${SEARCH_DIR}/ -name "Job_${JobName}" ) 
    5454    if [ X$FileList == X ] ; then 
    5555      NbOcc=0 
    5656    else 
    5757      NbOcc=${#FileList[@]} 
     58      fg_new=true 
    5859    fi 
    5960  fi 
     
    6263    0) 
    6364      echo "${JobName} not found." 
    64       echo "You can try : '-n' option to automatically search your \$WORKDIR, " 
    65       echo "              '-p' option to provide the config.card path, " 
    66       echo "              manually editing your ${SimuCatalog}" 
     65      echo "You can try : *) '-s' option to automatically search your \$WORKDIR, " 
     66      echo "              *) '-p' option to provide the config.card path, " 
     67      echo "              *) manually editing your ${SimuCatalog}" 
    6768      exit ;; 
    6869    1) 
     
    261262 
    262263fg_color=true 
    263 fg_new=false 
     264fg_search=false 
    264265fg_quiet=false 
    265266fg_path=false 
     
    279280      echo "  -q : quiet" 
    280281      echo "  -j : print n post-processing jobs (default is 10)" 
    281       echo "  -n : look for a new job in \$WORKDIR and fill in " 
     282      echo "  -s : search for a new job in \$WORKDIR and fill in " 
    282283      echo "       the catalog before printing information" 
    283284      echo "  -p : give the config.card path to a new simulation, " 
     
    287288#      fg_color=false 
    288289#      shift 1 ;; 
    289     -n|-new) 
    290       fg_new=true 
     290    -s|-search) 
     291      fg_search=true 
    291292      shift 1 ;; 
    292293    -q|-quiet) 
     
    311312done 
    312313 
    313 if ( [ ! $fg_path ] && [ $# -lt 1 ] ) ; then 
     314if ( ( ! $fg_path ) && [ $# -lt 1 ] ) ; then 
    314315  $0 -h 
     316  exit 
     317fi 
     318 
     319if ( ( ${fg_path} ) && ( ${fg_search} ) ) ; then 
     320  echo "You cannot use -s and -p at the same time" 
    315321  exit 
    316322fi 
     
    473479  # Check jobs 
    474480  # ---------- 
     481  NbLines=0 
    475482  for JobType in ${JobType_list[*]} ; do  
    476483    eval String=\${${JobType}_String} 
    477484    eval Field=\${${JobType}_Field} 
    478485 
    479     FileList=$( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} ) 
     486    set -A FileList $( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} ) 
     487 
     488    if [ ${#FileList[*]} -gt ${NbLines} ] ; then 
     489      NbLines=${#FileList[*]} 
     490    fi 
    480491 
    481492    (( ind = 0 )) 
    482     for FileName in ${FileList} ; do 
     493    for FileName in ${FileList[*]} ; do 
    483494      LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' ) 
    484495 
     
    503514  # ========================== 
    504515  JobType=monitoring 
    505   LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \ 
    506                   awk '{ print $NF }' ) 
    507   eval ${JobType}_Date=${LastDate} 
     516  if [ -d ${CWORK_DIR}/MONITORING ] ; then 
     517    LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \ 
     518                    awk '{ print $NF }' ) 
     519    eval ${JobType}_Date=${LastDate} 
     520  fi 
    508521 
    509522  # Check last ATLAS jobs 
    510523  # ===================== 
    511524  JobType=atlas 
    512   FileList=$( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} ) 
    513  
    514   (( ind = 0 )) 
    515   for FileName in ${FileList} ; do 
    516     eval ${JobType}_Date[$ind]=${FileName} 
    517     (( ind = ind + 1 )) 
    518   done 
     525  if [ -d ${CWORK_DIR}/ATLAS ] ; then 
     526    set -A FileList $( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} ) 
     527 
     528    if [ ${#FileList[*]} -gt ${NbLines}=0 ] ; then 
     529      NbLines=${#FileList[*]} 
     530    fi 
     531 
     532    (( ind = 0 )) 
     533    for FileName in ${FileList[*]} ; do 
     534      eval ${JobType}_Date[$ind]=${FileName} 
     535      (( ind = ind + 1 )) 
     536    done 
     537  fi 
    519538 
    520539 
     
    528547  AffichResult -f 
    529548  ind=0 
    530   while [ $ind -lt $NbHisto ] ; do 
     549  while [ $ind -lt $NbLines ] ; do 
    531550    AffichResult -j 
    532551    (( ind = ind + 1 )) 
Note: See TracChangeset for help on using the changeset viewer.