Changeset 565


Ignore:
Timestamp:
02/29/12 15:41:53 (12 years ago)
Author:
sdipsl
Message:
  • Pack submission is active for pack_restart and pack_debug.
    • work on titane
    • SX9 needs a patch (post-processing will move to mercure frontend)
  • Use IGCM_date function in pack_restart and pack_debug. Should work for any frequency.
  • Cleaning.
Location:
trunk/libIGCM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_pack_debug

    r554 r565  
    266266#### Preparation de l'environnement 
    267267# repertoire dans lequel seront crees les archives 
     268#STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG 
    268269STORE_DEBUG=${R_SAVE}/DEBUG 
    269270IGCM_sys_MkdirArchive ${STORE_DEBUG} 
    270  
    271 #STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG 
    272 #mkdir -p ${STORE_DEBUG} 
    273271 
    274272# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) 
     
    290288find ${PATH_SIMUL}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt 
    291289 
    292 ###cat  ${RUN_DIR}/liste_debug_files.txt | xargs dmget  
    293  
    294290# Rename debug files we will work with using symlinks 
    295291#gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt 
     
    297293 
    298294# List renamed debug files 
    299 ls -l ${RUN_DIR}/???_*${JobName}* > ${RUN_DIR}/new_liste_debug_files.txt 
    300  
    301 ### 2- creer les listes de fichiers par periode #### 
    302 ### 2.1- dechiffrer PeriodPack et le separer en year et month ### 
    303 case ${PeriodPack} in 
    304 *Y|*y)  
    305   periodpackinyear=$( echo ${PeriodPack} | sed -e 's/[yY]//' )  
    306   periodpackinmonth=0 
    307   ;; 
    308  
    309 *M|*m)  
    310   periodpackinyear=0 
    311   periodpackinmonth=$( echo ${PeriodPack} | sed -e 's/[mM]//' )  
    312   ;; 
    313  
    314 *) 
    315   echo "PeriodPack doit etre en mois ou annees" 
    316   IGCM_debug_Exit "period pack unit" 
    317   ;; 
    318  
    319 esac 
    320  
    321 ### 2.2- extraire l'annee et le mois de DateBegin ### 
    322 date_begin=${DateBegin} 
    323 date_end=${DateEnd} 
    324  
    325 IGCM_date_GetYearMonth ${date_begin} year_begin month_begin 
    326 IGCM_date_GetYearMonth ${date_end}   year_end   month_end 
     295find ${RUN_DIR} -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt 
    327296 
    328297# ------------------------------------------------------------------ 
     
    331300IGCM_debug_Verif_Exit_Post 
    332301 
    333 ### 2.3- creation des listes ### 
    334 date_begin_pack=${date_begin} 
    335 month_begin_pack=${month_begin} 
    336 year_begin_pack=${year_begin} 
    337  
    338 date_end_simulation=${date_end} 
    339  
     302# Init loop 
     303date_begin_pack=${DateBegin} 
     304date_end_simulation=${DateEnd} 
    340305number_pack=1 
    341306 
     
    347312  IGCM_debug_PrintVariables 3 number_pack 
    348313 
    349   (( month_end_pack = month_begin_pack + periodpackinmonth )) 
    350   (( add_year = ${month_end_pack} / 13 )) 
    351   if [ ${month_end_pack} -ge 13 ] ; then  
    352     (( month_end_pack = ${month_end_pack} % 12 )) 
    353   fi  
    354  
    355   (( year_end_pack = year_begin_pack + periodpackinyear + add_year )) 
    356  
    357   date_end_pack=${year_end_pack}$( printf "%02i\n" ${month_end_pack} )01 
    358  
    359   for file in $( gawk '{print $9}' ${RUN_DIR}/new_liste_debug_files.txt ); do 
     314  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} ) 
     315  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} ) 
     316 
     317  for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do 
    360318    extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_[0-9]*_//" ) 
    361319    date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 
     
    363321    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then  
    364322        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt 
     323        echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt 
     324 
    365325#    Will not work. Need to find a better ordering. 
    366326#    elif [ ${date_file} -ge ${date_end_pack} ] ; then 
     
    369329  done 
    370330 
    371   month_begin_pack=${month_end_pack} 
    372   year_begin_pack=${year_end_pack} 
    373   date_begin_pack=${year_begin_pack}$( printf "%02i\n" ${month_begin_pack} )01 
    374  
    375   # Here we create tar files directly in $STORE. Avoid to create then to copy. 
    376   tar -cvf ${STORE_DEBUG}/${JobName}_${year_begin_pack}_${year_end_pack}_debug.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt 
    377   cat  ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm  
     331  # Create tar files 
     332  IGCM_debug_Print 1 "Tar ongoing" 
     333  tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt 
     334  # Save it 
     335  IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar ${STORE_DEBUG} 
     336  # Clean it 
     337  IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar 
     338  # Clean links 
     339  cat ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm 
     340  # Clean files links pointed to 
     341  cat ${RUN_DIR}/liste_remove_pack_${number_pack}.txt | xargs rm 
     342  # Save the list of files that has been pack (tar) 
    378343  mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_DEBUG} 
     344  IGCM_debug_Print 1 "Tar and cleaning done" 
    379345 
    380346  (( number_pack = number_pack + 1 )) 
    381347 
     348  # Add 1 day to date_end_pack to have the new date_begin_pack 
     349  date_begin_pack=$( $( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) 
     350 
    382351done 
  • trunk/libIGCM/AA_pack_restart

    r554 r565  
    266266#### Preparation de l'environnement 
    267267# repertoire dans lequel seront crees les archives 
     268#STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART 
    268269STORE_RESTART=${R_SAVE}/RESTART 
    269270IGCM_sys_MkdirArchive ${STORE_RESTART} 
    270  
    271 #STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART 
    272 #mkdir -p ${STORE_RESTART} 
    273271 
    274272# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) 
     
    289287# Create sorted restart list to work with 
    290288find ${PATH_SIMUL}/*/Restart -name "*nc" | sort >> ${RUN_DIR}/liste_restart_files.txt 
    291 #sort ${RUN_DIR}/liste_restart_files.txt > ${RUN_DIR}/tmp.txt 
    292 #mv ${RUN_DIR}/tmp.txt ${RUN_DIR}/liste_restart_files.txt 
    293  
    294 ###cat  ${RUN_DIR}/liste_restart_files.txt | xargs dmget  
    295  
    296 # Rename restart files we will work with 
     289 
     290# Rename restart files we will work with using symlinks 
    297291#gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt 
    298292gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt 
    299293 
    300294# List renamed restart files 
    301 ls -l ${RUN_DIR}/*.nc > ${RUN_DIR}/new_liste_restart_files.txt 
    302  
    303 ### 2- creer les listes de fichiers par periode #### 
    304 ### 2.1- dechiffrer PeriodPack et le separer en year et month ### 
    305 case ${PeriodPack} in 
    306 *Y|*y)  
    307   periodpackinyear=$( echo ${PeriodPack} | sed -e 's/[yY]//' )  
    308   periodpackinmonth=0 
    309   ;; 
    310  
    311 *M|*m)  
    312   periodpackinyear=0 
    313   periodpackinmonth=$( echo ${PeriodPack} | sed -e 's/[mM]//' )  
    314   ;; 
    315  
    316 *) 
    317   echo "PeriodPack doit etre en mois ou annees" 
    318   IGCM_debug_Exit "period pack unit" 
    319   ;; 
    320  
    321 esac 
    322  
    323 ### 2.2- extraire l'annee et le mois de DateBegin ### 
    324 date_begin=${DateBegin} 
    325 date_end=${DateEnd} 
    326  
    327 IGCM_date_GetYearMonth ${date_begin} year_begin month_begin 
    328 IGCM_date_GetYearMonth ${date_end}   year_end   month_end 
     295find ${RUN_DIR} -name "*.nc" -ls | sort -k 11 > ${RUN_DIR}/new_liste_restart_files.txt 
    329296 
    330297# ------------------------------------------------------------------ 
     
    333300IGCM_debug_Verif_Exit_Post 
    334301 
    335 ### 2.3- creation des listes ### 
    336 date_begin_pack=${date_begin} 
    337 month_begin_pack=${month_begin} 
    338 year_begin_pack=${year_begin} 
    339  
    340 date_end_simulation=${date_end} 
    341  
     302# Init loop 
     303date_begin_pack=${DateBegin} 
     304date_end_simulation=${DateEnd} 
    342305number_pack=1 
    343306 
     
    349312  IGCM_debug_PrintVariables 3 number_pack 
    350313 
    351   (( month_end_pack = month_begin_pack + periodpackinmonth )) 
    352   (( add_year = ${month_end_pack} / 13 )) 
    353   if [ ${month_end_pack} -ge 13 ] ; then  
    354     (( month_end_pack = ${month_end_pack} % 12 )) 
    355   fi  
    356  
    357   (( year_end_pack = year_begin_pack + periodpackinyear + add_year )) 
    358  
    359   date_end_pack=${year_end_pack}$( printf "%02i\n" ${month_end_pack} )01 
    360  
    361   for file in $( gawk '{print $9}' ${RUN_DIR}/new_liste_restart_files.txt ); do 
     314  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} ) 
     315  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} ) 
     316 
     317  for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_restart_files.txt ); do 
    362318    extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_//" ) 
    363319    date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 
     
    365321    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then  
    366322        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt 
     323        echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt 
     324 
    367325#    Will not work. Need to find a better ordering. 
    368326#    elif [ ${date_file} -ge ${date_end_pack} ] ; then 
     
    371329  done 
    372330 
    373   month_begin_pack=${month_end_pack} 
    374   year_begin_pack=${year_end_pack} 
    375   date_begin_pack=${year_begin_pack}$( printf "%02i\n" ${month_begin_pack} )01 
    376  
    377   # Here we create tar files directly in $STORE. Avoid to create then to copy. 
    378   tar -cvf ${STORE_RESTART}/${JobName}_${year_begin_pack}_${year_end_pack}_restart.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt 
    379   cat  ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm  
     331  # Create tar files 
     332  IGCM_debug_Print 1 "Tar ongoing" 
     333  tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt 
     334  # Save it 
     335  IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar ${STORE_RESTART} 
     336  # Clean it 
     337  IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar 
     338  # Clean links 
     339  cat ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm 
     340  # Clean files links pointed to 
     341  cat ${RUN_DIR}/liste_remove_pack_${number_pack}.txt | xargs rm 
     342  # Save the list of files that has been pack (tar) 
    380343  mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_RESTART} 
     344  IGCM_debug_Print 1 "Tar and cleaning done" 
    381345 
    382346  (( number_pack = number_pack + 1 )) 
    383347 
     348  # Add 1 day to date_end_pack to have the new date_begin_pack 
     349  date_begin_pack=$( $( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) 
     350 
    384351done 
  • trunk/libIGCM/libIGCM_post/libIGCM_post.ksh

    r555 r565  
    486486    DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 )) 
    487487    # 
    488     PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysInPeriod} ) 
     488    PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} ) 
    489489    # 
    490490    script=pack_debug 
     
    510510    IGCM_sys_MkdirWork ${POST_DIR} 
    511511    IGCM_debug_Verif_Exit_Post 
    512 #    IGCM_sys_QsubPost ${script} 
     512    IGCM_sys_QsubPost ${script} 
     513EOF 
     514    # 
     515    script=pack_restart 
     516    # 
     517    Script_Post_Output=${script}.${PeriodDateEnd} 
     518    # 
     519    IGCM_sys_RshPost <<-EOF 
     520    export DEBUG_debug=${DEBUG_debug} 
     521    export MODIPSL=${MODIPSL} 
     522    export libIGCM_SX=${libIGCM} 
     523    export libIGCM=${libIGCM_POST} 
     524    export SUBMIT_DIR=${SUBMIT_DIR} 
     525    export MASTER=${MASTER} 
     526    export DateBegin=${PackDateBegin} 
     527    export DateEnd=${PeriodDateEnd} 
     528    export PeriodPack=${config_UserChoices_PackFrequency} 
     529    export StandAlone=false 
     530    export listVarEnv=${listVarEnv} 
     531    export Script_Post_Output=${Script_Post_Output} 
     532    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     533    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 
     534    IGCM_sys_MkdirWork ${POST_DIR} 
     535    IGCM_debug_Verif_Exit_Post 
     536    IGCM_sys_QsubPost ${script} 
    513537EOF 
    514538 
Note: See TracChangeset for help on using the changeset viewer.