Changeset 1013


Ignore:
Timestamp:
07/04/14 12:39:11 (10 years ago)
Author:
sdipsl
Message:

first try to furgely support ergon. not fully tested
should find regular restart on gaya
should find tared restart on gaya
Continuing a simulation is still at risk if possible ...

File:
1 edited

Legend:

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

    r1012 r1013  
    217217function IGCM_sys_RshArchive { 
    218218  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 
     219  typeset ergonCount gayaCount 
    219220  DEBUG_sys=false IGCM_sys_IsFileArchived "$@" 
    220221  if [ $? = 0 ] ; then 
     222    status=0 
     223    #special case for the find command. Only used together with RshArchive to find tared restart 
     224    if [ "X$( echo $@ | grep ^find )" != "X" ] ; then 
     225      # Ergon first 
     226      rsh ${STOREHOST} exec /bin/ksh <<-EOF > ergonList.txt 
     227    ${@} 
     228EOF 
     229      (( status=status + $? )) 
     230      # Gaya turn 
     231      rsh gaya exec /bin/ksh <<-EOF > gayaList.txt 
     232    ${@} 
     233EOF 
     234      (( status=status + $? )) 
     235 
     236      # the more the better 
     237      ergonCount=$( cat ergonList.txt | wc -l ) 
     238      gayaCount=$(  cat gayaList.txt | wc -l  ) 
     239 
     240      [ ${ergonCount} -ge ${gayaCount} ] && cat ergonList.txt || cat gayaList.txt 
     241      rm -f ergonList.txt gayaList.txt 
     242    else 
    221243    rsh ${STOREHOST} exec /bin/ksh <<-EOF 
    222244    ${@} 
    223245EOF 
    224246    status=$? 
     247    fi 
    225248  else 
    226249    /bin/ksh <<-EOF 
     
    511534#D-* Examples: 
    512535#D- 
     536#function IGCM_sys_TestFileArchive { 
     537#  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 
     538#  typeset ExistFlag TempCommandFile 
     539#  TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 
     540#  #Command depends on targeted file system 
     541#  #We want it quiet 
     542#  DEBUG_sys=false IGCM_sys_IsFileArchived $1 
     543#  if [ $? = 0 ] ; then 
     544#    ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 
     545#  else 
     546#    ExistFlag=$( ${TempCommandFile} ) 
     547#  fi 
     548#  IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 
     549# 
     550#  return ${ExistFlag} 
     551#} 
     552 
     553#D-#================================================== 
     554#D-function IGCM_sys_TestFileArchive 
     555#D-* Purpose: Test file that must NOT EXISTS on Archive 
     556#D-* Examples: 
     557#D- 
    513558function IGCM_sys_TestFileArchive { 
    514559  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 
    515   typeset ExistFlag TempCommandFile 
    516   TempCommandFile="[ -f $1 ] && echo 0 || echo 1" 
    517   #Command depends on targeted file system 
    518   #We want it quiet 
    519   DEBUG_sys=false IGCM_sys_IsFileArchived $1 
    520   if [ $? = 0 ] ; then 
    521     ExistFlag=$( IGCM_sys_RshArchive ${TempCommandFile} ) 
    522   else 
    523     ExistFlag=$( ${TempCommandFile} ) 
    524   fi 
     560  typeset ExistFlag finalPosition 
     561 
     562  finalPosition=$( mfls $1 | wc -l ) 
     563  [ ${finalPosition} -eq 8 ] && ExistFlag=1 || ExistFlag=0 
     564 
    525565  IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 
    526566 
    527567  return ${ExistFlag} 
    528568} 
     569 
    529570 
    530571#D-#================================================== 
     
    542583} 
    543584 
     585##D-#================================================== 
     586##D-function IGCM_sys_CountFileArchive 
     587##D-* Purpose: Count files on Archive filesystem 
     588##D-* Examples: 
     589##D- 
     590#function IGCM_sys_CountFileArchive { 
     591#  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 
     592#  #Command depends on targeted file system 
     593#  DEBUG_sys=false IGCM_sys_IsFileArchived $1 
     594#  if [ $? = 0 ] ; then 
     595#    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 
     596#    status=$? 
     597#  else 
     598#    ls ${@} 2>/dev/null | wc -l 
     599#    status=$? 
     600#  fi 
     601#  if [ ${status} -gt 0 ] ; then 
     602#    echo "IGCM_sys_CountFileArchive : erreur." 
     603#  fi 
     604#  IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 
     605#} 
     606 
    544607#D-#================================================== 
    545608#D-function IGCM_sys_CountFileArchive 
     
    549612function IGCM_sys_CountFileArchive { 
    550613  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 
     614  typeset status gayaPosition ergonPosition finalPosition gayaCount ergonCount 
    551615  #Command depends on targeted file system 
    552616  DEBUG_sys=false IGCM_sys_IsFileArchived $1 
    553617  if [ $? = 0 ] ; then 
    554     IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 
    555     status=$? 
     618    status=0 
     619    gayaPosition=$(  mfls ${@} | grep -n "++ Gaya"  | awk -F\: {'print $1'} ) 
     620    (( status=status + $? )) 
     621    ergonPosition=$( mfls ${@} | grep -n "++ Ergon" | awk -F\: {'print $1'} ) 
     622    (( status=status + $? )) 
     623    finalPosition=$( mfls ${@} | wc -l ) 
     624    (( status=status + $? )) 
     625 
     626    (( gayaCount  = ergonPosition - gayaPosition - 4 )) 
     627    (( ergonCount = finalPosition - ergonPosition - 2 )) 
     628 
     629    # return number of files found. greater the better 
     630    [ ${ergonCount} -ge ${gayaCount} ] && echo ${ergonCount} || echo ${gayaCount} 
     631 
     632    # "Ergon only" case 
     633    #IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" 
     634    #status=$? 
    556635  else 
    557636    ls ${@} 2>/dev/null | wc -l 
Note: See TracChangeset for help on using the changeset viewer.