Ignore:
Timestamp:
03/30/15 17:18:46 (9 years ago)
Author:
sdipsl
Message:

house keeping in libIGCM_sys (third pass). Will ease #248 and #251

File:
1 edited

Legend:

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

    r1179 r1180  
    6464# Host and user names 
    6565# $hostname ou hostname 
    66 typeset  HOST=${HOST:=$( hostname )} 
     66typeset HOST=${HOST:=$( hostname )} 
    6767# $username ou whoami 
    68 typeset  LOGIN=${LOGIN:=$( whoami )} 
     68typeset LOGIN=${LOGIN:=$( whoami )} 
    6969# $hostname of the MASTER job 
    70 ntypeset -r MASTER=iitm01 
     70typeset MASTER=iitm01 
    7171 
    7272#D- 
     
    8686 
    8787#==================================================== 
    88 # Source default environment 
     88# Set environment tools (ferret, nco, cdo, rebuild, ...) 
    8989#==================================================== 
    90 ##. /etc/profile 
    91  
    92 #==================================================== 
    93 # Set environment tools (ferret, nco, cdo) 
    94 #==================================================== 
    95 # Not applicable here 
     90# Not applicable here. Only rebuild path 
     91export export PATH=${PATH}:/gpfs1/home/sebastien/REBUILD/ 
    9692 
    9793#==================================================== 
     
    10096 
    10197#==================================================== 
    102 #- Mirror libIGCM from iitm to a post-processing machine 
     98#- MirrorlibIGCM for frontend 
    10399typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 
    104100 
     
    137133 
    138134#==================================================== 
    139 #- set PackDefault true on curie 
     135#- set PackDefault to false on iitm 
    140136PackDefault=false 
    141137 
     
    210206#D-#================================================== 
    211207#D-function IGCM_sys_RshMaster 
    212 #D-* Purpose: Just a fake command to wrapp 
    213 #D-           IGCM_card call in post-treatment 
    214 #D-           Ulam do not see brodie filesystem 
    215 #D-           Cesium do not see all mercure filesystem 
    216 #D-           That's why we need this hack. 
     208#D-* Purpose: Connection to frontend machine. 
    217209#D-* Examples: 
    218210#D- 
    219211function IGCM_sys_RshMaster { 
    220212  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 
    221   /bin/ksh <<-EOF 
     213  OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF 
    222214    export libIGCM=${libIGCM} 
    223215    export DEBUG_debug=${DEBUG_debug} 
     
    252244 
    253245#D-#================================================== 
     246#D-function IGCM_sys_RshArchive_NoError 
     247#D-* Purpose: Archive rsh command, without error 
     248#D-*          used only in monitoring.job 
     249#D-* Examples: 
     250#D- 
     251function IGCM_sys_RshArchive_NoError { 
     252  IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ 
     253  /bin/ksh <<-EOF 
     254    ${@} 2> /dev/null 
     255EOF 
     256  IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" 
     257} 
     258 
     259#D-#================================================== 
    254260#D-function IGCM_sys_RshPost 
    255261#D-* Purpose: Post-process rsh command 
     
    261267    echo "IGCM_sys_RshPost :" $@ 
    262268  fi 
    263  
    264   # keep standard input to keep it for postpone if ulam don't answer 
    265   cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    266  
    267   /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
     269  # keep standard input (stdin) for the loop onto temporary file 
     270  cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
     271 
     272  OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    268273  if [ $? -gt 0 ] ; then 
    269274    echo "IGCM_sys_RshPost : erreur." 
     
    271276  fi 
    272277  # delete temporary file 
    273   \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
     278  \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    274279 
    275280  IGCM_debug_PopStack "IGCM_sys_RshPost" 
     
    304309 
    305310  if [ ! -z ${config_UserChoices_MailName} ] ; then 
    306     mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt 
     311    mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt 
    307312  elif [ -f ~/.forward ] ; then 
    308     mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt 
     313    mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt 
    309314  else 
    310     mailx -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt 
     315    mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt 
    311316  fi 
    312317 
     
    353358  fi 
    354359  #- creation de repertoire sur le serveur fichier 
    355   mkdir -p $1 
    356   status=$? 
    357  
    358   if [ ${status} -gt 0 ] ; then 
    359     IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
    360     IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
     360  if [ ! -d ${1} ]; then 
     361    \mkdir -p $1 
     362    status=$? 
     363 
     364    if [ ${status} -gt 0 ] ; then 
     365      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 
     366      IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
     367    fi 
    361368  fi 
    362369  IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 
     
    473480#D-#================================================== 
    474481#D-function IGCM_sys_IsFileArchived 
    475 #D-* Purpose: Test file that must NOT EXISTS on Archive 
     482#D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only 
    476483#D-* Examples: 
    477484#D- 
     
    920927    fi 
    921928  fi 
    922  
    923929  IGCM_debug_PopStack "IGCM_sys_Mv" 
    924930} 
     
    10801086 
    10811087    if [ ${status} -gt 0 ] ; then 
    1082       echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 
     1088      IGCM_debug_Print 2 "IGCM_sys_Put_Rest : cp failed error code ${status}" 
    10831089      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
    10841090      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     
    12361242      i=0 
    12371243      while [ $i -lt $NB_ESSAI ] ; do 
    1238         # USUAL WAY 
    1239         \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    1240         status=$? 
     1244        if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 
     1245          # USUAL WAY 
     1246          \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
     1247          status=$? 
     1248        else 
     1249          # NOT SO USUAL WAY 
     1250          \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
     1251          status=$? 
     1252        fi 
    12411253        if [ ${status} -gt 0 ]; then 
    12421254          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 
     
    15071519  i=0 
    15081520  while [ $i -lt $NB_ESSAI ] ; do 
    1509     /gpfs1/home/sebastien/REBUILD/rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
     1521    rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 
    15101522    status=$? 
    15111523    if [ ${status} -gt 0 ] ; then 
     
    15831595  #  0  118 110.0000000000000   87.46478873239437 
    15841596  #  1  40  4.999999999999995   51.97183098591550 
     1597 
    15851598#  typeset iStation iProc list_opt file_in file_out prefix_invert 
    15861599#  typeset -Z4 j4 
     
    17781791 
    17791792        if ( ${OK_PARA_MPI} ) ; then 
    1780  
    17811793          (( mpi_count = 1 )) 
    17821794          until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     
    18121824 
    18131825        if ( ${OK_PARA_MPI} ) ; then 
    1814  
    18151826          (( mpi_count = 1 )) 
    18161827          until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     
    18411852    fi 
    18421853 
    1843   else # Only one executable. launch it. 
     1854  # Only one executable (SPMD mode). 
     1855  else 
    18441856 
    18451857    for comp in ${config_ListOfComponents[*]} ; do 
     
    23832395  if [ ${status} -gt 0 ] ; then 
    23842396    echo "IGCM_sys_ncrcat : ncrcat error" 
    2385       #IGCM_debug_Exit "ncrcat" 
     2397    #IGCM_debug_Exit "ncrcat" 
    23862398  fi 
    23872399 
Note: See TracChangeset for help on using the changeset viewer.