Changeset 565 for trunk/libIGCM/AA_pack_debug
- Timestamp:
- 02/29/12 15:41:53 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/AA_pack_debug
r554 r565 266 266 #### Preparation de l'environnement 267 267 # repertoire dans lequel seront crees les archives 268 #STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG 268 269 STORE_DEBUG=${R_SAVE}/DEBUG 269 270 IGCM_sys_MkdirArchive ${STORE_DEBUG} 270 271 #STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG272 #mkdir -p ${STORE_DEBUG}273 271 274 272 # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) … … 290 288 find ${PATH_SIMUL}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt 291 289 292 ###cat ${RUN_DIR}/liste_debug_files.txt | xargs dmget293 294 290 # Rename debug files we will work with using symlinks 295 291 #gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt … … 297 293 298 294 # 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 295 find ${RUN_DIR} -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt 327 296 328 297 # ------------------------------------------------------------------ … … 331 300 IGCM_debug_Verif_Exit_Post 332 301 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 303 date_begin_pack=${DateBegin} 304 date_end_simulation=${DateEnd} 340 305 number_pack=1 341 306 … … 347 312 IGCM_debug_PrintVariables 3 number_pack 348 313 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 360 318 extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) 361 319 date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) … … 363 321 if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 364 322 echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt 323 echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt 324 365 325 # Will not work. Need to find a better ordering. 366 326 # elif [ ${date_file} -ge ${date_end_pack} ] ; then … … 369 329 done 370 330 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) 378 343 mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_DEBUG} 344 IGCM_debug_Print 1 "Tar and cleaning done" 379 345 380 346 (( number_pack = number_pack + 1 )) 381 347 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 382 351 done
Note: See TracChangeset
for help on using the changeset viewer.