Changeset 1644 for modipsl


Ignore:
Timestamp:
01/31/12 17:31:30 (12 years ago)
Author:
jgipsl
Message:

Moved determination of JobName? to be done earlier in script ins_job. In config.card, JobName? can contain the varaiable RESOL_ATM_3D which will then be replaced by what is in .resol file (old funitioncality).


File:
1 edited

Legend:

Unmodified
Added
Removed
  • modipsl/trunk/util/ins_job

    r1619 r1644  
    108108 j=$(cd ${i%/*};/bin/pwd;) 
    109109 n_f=${F_RCI##*/}; 
    110  print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}"; 
    111110 
    112111 if [ ! X$( echo ${j} | grep USER_SPEC ) = X ] ; then 
    113112 # Do not treat config.card if it is in sub-directory of USER_SPEC 
    114113 # Continue to next config.card 
    115      echo "USER_SPEC directory exist in path, do not use this config.card" 
    116114     continue 
     115 else 
     116     print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}"; 
    117117 fi 
    118118  
     
    123123 config_UserChoices_JobNumProcTot=1 
    124124 config_UserChoices_UserSpec="" 
     125 RESOL_ATM_3D=this_is_a_test_string 
     126 RESOL=this_is_another_test_string 
    125127 typeset option 
    126128 for option in ${config_UserChoices[*]} ; do 
     
    128130 done 
    129131 
     132# Find the JobName : JobName might contain the variable RESOL_ATM_3D that will be replaced by what is in .resol file 
     133 if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL_ATM_3D} ) = X ] ; then 
     134    TRUERESOL=$( find ../ -name ".resol" -exec tail -1 {} \; | awk "-F=" '{print $2}' ) 
     135    JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL_ATM_3D}/${TRUERESOL}/" ) 
     136    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName} 
     137 elif [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL} ) = X ] ; then 
     138     TRUERESOL=$( find ../ -name ".resol" -exec head -1 {} \; ) 
     139     JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL}/${TRUERESOL}/" ) 
     140     IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName} 
     141 else 
     142     JobName=${config_UserChoices_JobName} 
     143 fi 
     144 echo "JobName=${JobName}" 
     145 
    130146# Add specific treatment for new type of directory structure  
    131147  if [ -d ${j}/USER_SPEC ] && [ -d ${j}/GENERAL ] ; then 
    132148      echo "This is new configuration structure" 
    133       echo "JobName=${config_UserChoices_JobName}" 
    134149 
    135150      if [ "X${config_UserChoices_UserSpec}" = X ] ; then 
     
    143158      fi 
    144159 
    145       if [ -d ${j}/${config_UserChoices_JobName} ] ; then 
    146           echo "Directory ${j}/${config_UserChoices_JobName} exist already, continue next config.card" 
     160      if [ -d ${j}/${JobName} ] ; then 
     161          echo "Directory ${j}/${JobName} exist already, continue next config.card" 
    147162          continue 
    148163      fi 
    149       cp -r ${j}/USER_SPEC/${config_UserChoices_UserSpec} ${j}/${config_UserChoices_JobName} 
    150       cp -r ${j}/GENERAL/* ${j}/${config_UserChoices_JobName}/. 
    151       cp -f ${j}/${F_CFG}  ${j}/${config_UserChoices_JobName}/. 
    152       j=${j}/${config_UserChoices_JobName} 
     164      cp -r ${j}/USER_SPEC/${config_UserChoices_UserSpec} ${j}/${JobName} 
     165      cp -r ${j}/GENERAL/* ${j}/${JobName}/. 
     166      cp -f ${j}/${F_CFG}  ${j}/${JobName}/. 
     167      j=${j}/${JobName} 
    153168      echo new j=$j 
    154169  fi 
     
    160175   \cp ${F_RCI} ${j}; 
    161176  } 
    162  # We keep explicitly JobName because it is not optionnal. 
    163  RESOL_ATM_3D=this_is_a_test_string 
    164  RESOL=this_is_another_test_string 
    165  if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL_ATM_3D} ) = X ] ; then 
    166     TRUERESOL=$( find ../ -name ".resol" -exec tail -1 {} \; | awk "-F=" '{print $2}' ) 
    167     config_UserChoices_JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL_ATM_3D}/${TRUERESOL}/" ) 
    168     IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${config_UserChoices_JobName} 
    169  else 
    170     if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL} ) = X ] ; then 
    171             TRUERESOL=$( find ../ -name ".resol" -exec head -1 {} \; ) 
    172             config_UserChoices_JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL}/${TRUERESOL}/" ) 
    173             IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${config_UserChoices_JobName} 
    174     fi 
    175  fi 
    176   
     177 
    177178 # File name for Job 
    178  n_f='Job_'${config_UserChoices_JobName}; 
     179 n_f='Job_'${JobName}; 
    179180 [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; } 
    180181 print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}"; 
     
    182183     -e "/^${W_P}/d"       \ 
    183184     -e "s%::modipsl::%${F_MOD}%" \ 
    184      -e "s/::Jobname::/${config_UserChoices_JobName}/" \ 
     185     -e "s/::Jobname::/${JobName}/" \ 
    185186     -e "s/::JobClass::/${config_UserChoices_JobClass}/" \ 
    186187     -e "s/::JobNumProcTot::/${config_UserChoices_JobNumProcTot}/" \ 
Note: See TracChangeset for help on using the changeset viewer.