Changeset 754
- Timestamp:
- 11/30/12 18:38:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/AA_RunChecker
r753 r754 13 13 14 14 #======================================================================# 15 16 15 # Display a report on how a simulation is faring. 16 17 17 18 18 function ChangeUsr { … … 35 35 36 36 if [ ${NbOcc} -eq 0 ] ; then 37 if [ X${fg_new} == X.true. ]; then38 echo "${JobName} not in Catalog, we'll try to find it in ${WORK _DIR}"37 if ( ${fg_new} ) ; then 38 echo "${JobName} not in Catalog, we'll try to find it in ${WORKDIR}" 39 39 40 40 set -A FileList 41 FileList=$( find ${WORK _DIR}/ -name "Job_${JobName}" )41 FileList=$( find ${WORKDIR}/ -name "Job_${JobName}" ) 42 42 echo $FileList 43 43 (( NbOcc = ${#FileList[@]} )) 44 44 else 45 45 echo "${JobName} not in Catalog." 46 echo " Use option -n / --new to look for it and add it to the catalog."46 echo "Add job_name, user_name, host_name and submit_dir in ${SimuCatalog}" 47 47 exit 48 48 fi … … 73 73 function AffichResult { 74 74 75 fg_first=".false." 76 fg_last=".false." 75 fg_first=false 76 fg_last=false 77 fg_job=false 77 78 78 79 while [ $# -ne 0 ] ; do 79 80 case ${1} in 80 81 -f|--first) 81 fg_first= ".true."82 fg_first=true 82 83 shift 1 ;; 83 84 -l|--last) 84 fg_last=".true." 85 fg_last=true 86 shift 1 ;; 87 -j|--job) 88 fg_job=true 85 89 shift 1 ;; 86 90 -*) … … 95 99 96 100 # Define colors 101 # ============= 97 102 ColEsc="\033[" 98 103 ColNon="${ColEsc}0m" # Return to normal … … 106 111 107 112 108 if [ X${fg_first} == X.true. ] ; then 113 #Â Print header 114 # ============ 115 if ( ${fg_first} ) ; then 109 116 Dum="" 110 117 (( len = 67 - ${#JobName} )) … … 117 124 echo "| Date Begin - DateEnd | PeriodState | Current Period | CumulPeriod | Nb : from : to |" 118 125 echo "|-------------------------|-------------|-------------------------|-------------|-----:----------:----------|" 126 127 printf "| %-10s - %-10s | " \ 128 $DateBegin $DateEnd 129 130 case $PeriodState in 131 Fatal) 132 Color=${ColFat} 133 break ;; 134 Completed) 135 Color=${ColCpl} 136 break ;; 137 Waiting|OnQueue) 138 Color=${ColAtt} 139 break ;; 140 *) 141 Color=${ColDef} 142 break ;; 143 esac 144 printf "${Color}%-11s${ColNon} | " $PeriodState 145 146 printf "%-10s - %-10s | %11s | " \ 147 $PeriodDateBegin $PeriodDateEnd $CumulPeriod 148 149 if ( [ X${NbRebuild} != X. ] && [ X${NbRebuild} != X0 ] ) ; then 150 printf "${ColRbl}%3s : %-8s : %-8s${ColNon} |\n" \ 151 $NbRebuild $FirstRebuild $LastRebuild 152 else 153 printf "%3s : %-8s : %-8s |\n" \ 154 $NbRebuild $FirstRebuild $LastRebuild 155 fi 156 157 printf "|-----------------------------------------------------------------------------------------------------------|\n" 158 printf "| Last |\n" 159 printf "| Rebuild | Pack_Output | Pack_Restart | Pack_Debug | Monitoring | Atlas |\n" 160 printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n" 161 119 162 return 120 163 fi 121 164 122 if [ X${fg_last} == X.true. ] ; then 165 # Print Post-processing job status 166 # ================================ 167 if ( ${fg_job} ) ; then 168 printf "|" 169 170 #Â Print rebuild and pack jobs 171 #Â --------------------------- 172 for JobType in ${JobType_list[*]} ; do 173 eval Date=\${${JobType}_Date[${ind}]} 174 eval Status=\${${JobType}_Status[${ind}]} 175 176 if [ X${Status} == XOK ] ; then 177 Color=${ColCpl} 178 else 179 Color=${ColFat} 180 fi 181 printf " ${Color}%-8s${ColNon} |" ${Date} 182 done 183 184 Color=${ColExp} 185 186 #Â Print monitoring jobs 187 #Â --------------------- 188 JobType=monitoring 189 if [ $ind -eq 0 ] ; then 190 eval Date=\${${JobType}_Date} 191 else 192 Date="" 193 fi 194 printf " ${Color}%-4s${ColNon} |" ${Date} 195 196 #Â Print atlas jobs 197 #Â ---------------- 198 JobType=atlas 199 eval Date=\${${JobType}_Date[${ind}]} 200 printf " ${Color}%-12s${ColNon} |" ${Date} 201 202 printf "\n" 203 204 return 205 fi 206 207 #Â Print footer 208 #Â ============ 209 if ( ${fg_last} ) ; then 123 210 printf "|===========================================================================================================|\n" 124 211 date +"${DateFormat}" … … 126 213 fi 127 214 128 printf "| %-10s - %-10s | " \129 $DateBegin $DateEnd130 131 case $PeriodState in132 Fatal)133 Color=${ColFat}134 break ;;135 Completed)136 Color=${ColCpl}137 break ;;138 Waiting|OnQueue)139 Color=${ColAtt}140 break ;;141 *)142 Color=${ColDef}143 break ;;144 esac145 printf "${Color}%-11s${ColNon} | " $PeriodState146 147 printf "%-10s - %-10s | %11s | " \148 $PeriodDateBegin $PeriodDateEnd $CumulPeriod149 150 if ( [ X${NbRebuild} != X. ] && [ X${NbRebuild} != X0 ] ) ; then151 printf "${ColRbl}%3s : %-8s : %-8s${ColNon} |\n" \152 $NbRebuild $FirstRebuild $LastRebuild153 else154 printf "%3s : %-8s : %-8s |\n" \155 $NbRebuild $FirstRebuild $LastRebuild156 fi157 158 printf "|-----------------------------------------------------------------------------------------------------------|\n"159 printf "| Last |\n"160 printf "| Rebuild | Pack_Output | Pack_Restart | Pack_Debug | Monitoring | Atlas |\n"161 printf "|------------------|------------------|------------------|------------------|--------------|----------------|\n"162 163 if [ X${Result[1]} == XOK ] ; then164 Color=${ColCpl}165 else166 Color=${ColFat}167 fi168 printf "| ${Color}%-8s${ColNon} |" ${LastDate[1]}169 170 if [ X${Result[2]} == XOK ] ; then171 Color=${ColCpl}172 else173 Color=${ColFat}174 fi175 printf " ${Color}%-8s${ColNon} |" ${LastDate[2]}176 177 if [ X${Result[3]} == XOK ] ; then178 Color=${ColCpl}179 else180 Color=${ColFat}181 fi182 printf " ${Color}%-8s${ColNon} |" ${LastDate[3]}183 184 if [ X${Result[4]} == XOK ] ; then185 Color=${ColCpl}186 else187 Color=${ColFat}188 fi189 printf " ${Color}%-8s${ColNon} |" ${LastDate[4]}190 191 Color=${ColExp}192 printf " ${Color}%-4s${ColNon} | ${Color}%-12s${ColNon} |\n" \193 ${LastDate[5]} ${LastDate[6]}194 215 } 195 216 … … 203 224 CurrentGrp=$( groups $CurrentUsr | awk '{print $3}' ) 204 225 226 if ( [ $# -eq 0 ] ) ; then 227 $0 -h 228 exit 229 fi 230 231 # Arguments 232 # ========= 233 # Default argument values 234 #Â ----------------------- 235 TargetUsr=${CurrentUsr} 236 HostName=$( hostname | sed -e "s/[0-9].*//" ) 237 238 fg_color=true 239 fg_new=false 240 fg_quiet=false 241 NbHisto=10 242 243 # Get arguments from command line 244 # ------------------------------- 245 while [ $# -ne 0 ] ; do 246 case $1 in 247 -h|--help|-help) 248 echo "usage: $0 [-u TargetUsr] JobName" 249 exit ;; 250 -b|-nocolor) 251 fg_color=false 252 shift 1 ;; 253 -n|-new) 254 fg_new=true 255 shift 1 ;; 256 -q|-quiet) 257 fg_quiet=true 258 shift 1 ;; 259 -p|-config-path) 260 ConfigPath="$2" 261 shift 2 ;; 262 -j|-job-number) 263 NbHisto="$2" 264 shift 2 ;; 265 -u|-user) 266 TargetUsr="$2" 267 shift 2 ;; 268 -*) 269 $0 -h 270 exit ;; 271 *) 272 break ;; 273 esac 274 done 275 276 if [ $# -lt 1 ] ; then 277 $0 -h 278 exit 279 fi 280 281 282 # Load libIGCM library 283 # ==================== 205 284 libIGCM=${libIGCM:=::modipsl::/libIGCM} 206 285 … … 215 294 . ${libIGCM}/libIGCM_config/libIGCM_config.ksh 216 295 217 if ( [ $# -eq 0 ] ) ; then 218 $0 -h 219 exit 296 297 JobName=$1 298 299 if ( ${fg_quiet} ) ; then 300 NbHisto=1 220 301 fi 221 222 # Default argument values223 TargetUsr=${CurrentUsr}224 HostName=$( hostname | sed -e "s/[0-9].*//" )225 226 fg_color=".true."227 fg_new=".false."228 fg_quiet=".false."229 (( NbHisto = 1 ))230 231 # Get arguments from command line232 while [ $# -ne 0 ] ; do233 case $1 in234 -h|--help|-help)235 echo "usage: $0 [-u TargetUsr] JobName"236 exit ;;237 -b|--nocolor)238 fg_color=".false."239 shift 1 ;;240 -n|--new)241 fg_new=".true."242 shift 1 ;;243 -q|--quiet)244 fg_quiet=".true."245 shift 1 ;;246 -p|--config-path)247 ConfigPath="$2"248 shift 2 ;;249 -u|--user)250 TargetUsr="$2"251 shift 2 ;;252 -*)253 $0 -h254 exit ;;255 *)256 break ;;257 esac258 done259 260 JobName=$1261 302 262 303 echo "TargetUsr = ${TargetUsr}" … … 274 315 DateFormat="%d/%m/%y %R:%S" 275 316 276 # Find SUBMIT_DIR fromcatalog277 317 # Find SUBMIT_DIR in catalog 318 # ========================== 278 319 SearchCatalog 279 320 280 # Go to SUBMIT_DIR281 321 if [ ! X${SUBMIT_DIR} == X ] ; then 282 322 … … 286 326 287 327 # Extract usefull information from run.card and config.card 328 # ========================================================= 288 329 289 330 RunFile="${SUBMIT_DIR}/run.card" … … 332 373 if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then 333 374 REBUILD_DIR=${R_SAVE}/TMP 375 RebuildJob="rebuild_fromArchive" 334 376 else 335 377 REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 378 RebuildJob="rebuild_fromWorkdir" 336 379 fi 337 380 … … 350 393 if [ $PeriodState != "Waiting" ] ; then 351 394 352 # Check missing rebuilds 395 # Check pending rebuilds 396 # ====================== 353 397 354 398 set -A RebuildList $( find ${REBUILD_DIR}/ -name "REBUILD_*" | sort ) … … 371 415 fi 372 416 373 typeset -A LastDate Result 374 375 # Check last REBUILD 376 FileType=rebuild_* 377 (( ind = 1 )) 378 379 LastDate[$ind]=$( ls ${POST_DIR}/${FileType}.*.out | tail -n ${NbHisto} | awk -F"." '{ print $2 }' ) 380 381 dum=$( basename $( grep ^IGCM_sys_PutBuffer_Out ${POST_DIR}/${FileType}.${LastDate[$ind]}.out | tail -1 | awk '{ print $4 }' ) | awk -F"_" '{ print $3 }' ) 382 383 if [[ ${dum} == ${LastDate[$ind]} ]] ; then 384 Result[$ind]=OK 385 else 386 Result[$ind]=KO 387 fi 388 389 # Check last PACK jobs 390 for FileType in pack_output pack_restart pack_debug ; do 417 418 # Check last REBUILD and PACK* jobs 419 # ================================= 420 # Define input parameters 421 # ----------------------- 422 set -A JobType_list "${RebuildJob}" "pack_output" "pack_restart" "pack_debug" 423 424 for JobType in ${JobType_list[*]} ; do 425 typeset name1="${JobType}_String" 426 typeset name2="${JobType}_Field" 427 if [ X${JobType} == X${RebuildJob} ] ; then 428 eval ${name1}=IGCM_sys_PutBuffer_Out 429 eval ${name2}=4 430 else 431 eval ${name1}=IGCM_sys_Put_Out 432 eval ${name2}=3 433 fi 434 done 435 436 #Â Check jobs 437 # ---------- 438 for JobType in ${JobType_list[*]} ; do 439 eval String=\${${JobType}_String} 440 eval Field=\${${JobType}_Field} 441 442 FileList=$( ls ${POST_DIR}/${JobType}.*.out | tail -n ${NbHisto} ) 443 444 (( ind = 0 )) 445 for FileName in ${FileList} ; do 446 LastDate=$( basename ${FileName} | awk -F"." '{ print $(NF-1) }' ) 447 448 dum=$( basename $( grep ^${String} ${POST_DIR}/${JobType}.${LastDate}.out | \ 449 tail -1 | awk -v Field=${Field} '{ print $( Field ) }' ) | \ 450 awk -F"_" '{ print $3 }' ) 451 452 if [[ X${dum} == X${LastDate} ]] ; then 453 Status=OK 454 else 455 Status=KO 456 fi 457 458 eval ${JobType}_Date[$ind]=${LastDate} 459 eval ${JobType}_Status[$ind]=${Status} 460 461 (( ind = ind + 1 )) 462 done 463 done 464 465 # Check last MONITORING jobs 466 # ========================== 467 JobType=monitoring 468 LastDate=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | \ 469 awk '{ print $NF }' ) 470 eval ${JobType}_Date=${LastDate} 471 472 # Check last ATLAS jobs 473 # ===================== 474 JobType=atlas 475 FileList=$( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} ) 476 477 (( ind = 0 )) 478 for FileName in ${FileList} ; do 479 eval ${JobType}_Date[$ind]=${FileName} 391 480 (( ind = ind + 1 )) 392 393 LastDate[$ind]=$( ls ${POST_DIR}/${FileType}.*.out | tail -n ${NbHisto} | awk -F"." '{ print $2 }' )394 395 dum=$( basename $( grep ^IGCM_sys_Put_Out ${POST_DIR}/${FileType}.${LastDate[$ind]}.out | tail -1 | awk '{ print $3 }' ) | awk -F"_" '{ print $3 }' )396 397 if [[ ${dum} == ${LastDate[$ind]} ]] ; then398 Result[$ind]=OK399 else400 Result[$ind]=KO401 fi402 481 done 403 482 404 483 405 # Check last MONITORING jobs406 407 #set -vx408 409 FileType=monitoring410 (( ind = ind + 1 ))411 412 LastDate[$ind]=$( cdo showyear ${CWORK_DIR}/MONITORING/files/ATM_bils_global_ave.nc 2> /dev/null | awk '{ print $NF }' )413 414 # Check last ATLAS jobs415 416 FileType=atlas417 (( ind = ind + 1 ))418 419 LastDate[$ind]=$( ls ${CWORK_DIR}/ATLAS | tail -n ${NbHisto} )420 421 422 484 # Time of last write on run.card 485 # ============================== 423 486 LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | awk '{print $6 " " $7}' ) 424 487 425 488 426 489 # Print results 490 # ============= 427 491 AffichResult -f 428 AffichResult 492 ind=0 493 while [ $ind -lt $NbHisto ] ; do 494 AffichResult -j 495 (( ind = ind + 1 )) 496 done 429 497 AffichResult -l 430 498
Note: See TracChangeset
for help on using the changeset viewer.