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.
File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.