Changeset 955 for trunk/libIGCM
- Timestamp:
- 10/07/13 16:35:45 (11 years ago)
- Location:
- trunk/libIGCM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/AA_RunChecker
r953 r955 16 16 17 17 18 19 18 #======================================================================# 20 19 … … 40 39 fg_search=false 41 40 fg_quiet=false 41 fg_running=false 42 42 fg_path=false 43 43 NbHisto=20 … … 45 45 # Get arguments from command line 46 46 # ------------------------------- 47 while getopts :hj:p:qsu: Opt ; do47 while getopts :hj:p:qsu:r Opt ; do 48 48 case $Opt in 49 49 h) … … 61 61 echo " -p : give the directory (absolute path) containing " 62 62 echo " the config.card instead of the job name." 63 echo " -r : check all running simulations." 63 64 exit 0 ;; 64 65 j) … … 78 79 TargetUsr=${OPTARG} 79 80 ;; 81 r) 82 fg_running=true 83 ;; 80 84 :) 81 85 echo "$0: -"${OPTARG}" option: missing value" … … 90 94 shift $(($OPTIND-1)) 91 95 96 # If no config.card path is given, and we're not looking for running simulations, 97 # at least one JobName must be given. 92 98 if ( ( ! ${fg_path} ) && ( ! ${fg_running} ) && [ $# -lt 1 ] ) ; then 93 99 $0 -h … … 121 127 122 128 123 JobName=$1 129 if ( ${fg_running} ) ; then 130 # Look for running simu 131 IGCM_sys_ListJobInQueue ${TargetUsr} JobNameList 132 fi 133 134 if [ $# -ge 1 ] ; then 135 set -A JobNameList ${JobNameList[*]} ${*} 136 fi 137 138 if [ ${#JobNameList[*]} -lt 1 ] ; then 139 echo "No running simulation found." 140 exit 0 141 fi 142 124 143 125 144 if ( ${fg_quiet} ) ; then … … 134 153 fi 135 154 136 # Find SUBMIT_DIR in catalog 137 # ========================== 138 IGCM_check_SearchCatalog 139 140 if [ ! X${SUBMIT_DIR} == X ] ; then 141 142 IGCM_sys_Cd $SUBMIT_DIR 143 144 145 # Extract usefull information from run.card and config.card 146 # ========================================================= 147 148 RunFile="${SUBMIT_DIR}/run.card" 149 ConfFile="${SUBMIT_DIR}/config.card" 150 151 IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card 152 IGCM_check_CommonDef 153 154 155 if [ -s ${RunFile} ] ; then 156 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodState 157 PeriodState=${run_Configuration_PeriodState} 158 else 159 PeriodState="Waiting" 155 156 for JobName in ${JobNameList[*]} ; do 157 158 # Find SUBMIT_DIR in catalog 159 # ========================== 160 IGCM_check_SearchCatalog 161 Status=$? 162 163 if [ $Status -eq 0 ] ; then 164 165 IGCM_sys_Cd $SUBMIT_DIR 166 167 168 # Extract usefull information from run.card and config.card 169 # ========================================================= 170 171 RunFile="${SUBMIT_DIR}/run.card" 172 ConfFile="${SUBMIT_DIR}/config.card" 173 174 IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card 175 IGCM_check_CommonDef 176 177 178 if [ -s ${RunFile} ] ; then 179 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodState 180 PeriodState=${run_Configuration_PeriodState} 181 else 182 PeriodState="Waiting" 183 fi 184 185 if ( [ X${PeriodState} == XRunning ] || [ X${PeriodState} == XOnQueue ] ) ; then 186 #NbRun=$( ccc_mstat -f | grep -c ${JobName} ) 187 IGCM_sys_CountJobInQueue ${JobName} NbRun 188 189 if [ ${NbRun} -eq 0 ] ; then 190 PeriodState="Fatal" 191 fi 192 fi 193 194 DateBegin=${config_UserChoices_DateBegin} 195 DateEnd=${config_UserChoices_DateEnd} 196 TagName=${config_UserChoices_TagName} 197 ExperimentName=${config_UserChoices_ExperimentName} 198 SpaceName=${config_UserChoices_SpaceName} 199 200 201 if ( [ ! X${PeriodState} == XWaiting ] && [ ! X${PeriodState} == XCompleted ] ) ; then 202 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateBegin 203 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateEnd 204 IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod 205 PeriodDateBegin=${run_Configuration_PeriodDateBegin} 206 PeriodDateEnd=${run_Configuration_PeriodDateEnd} 207 CumulPeriod=${run_Configuration_CumulPeriod} 208 else 209 PeriodDateBegin="." 210 PeriodDateEnd="." 211 CumulPeriod="." 212 fi 213 214 DATA_DIR=${R_SAVE} 215 POST_DIR=${R_BUFR}/Out 216 CWORK_DIR=${R_FIGR} 217 218 if [ ${TargetUsr} != ${CurrentUsr} ] ; then 219 DATA_DIR=$( IGCM_check_ChangeUsr ${DATA_DIR} ) 220 POST_DIR=$( IGCM_check_ChangeUsr ${POST_DIR} ) 221 CWORK_DIR=$( IGCM_check_ChangeUsr ${CWORK_DIR} ) 222 REBUILD_DIR=$( IGCM_check_ChangeUsr ${REBUILD_DIR} ) 223 fi 224 225 if [ $PeriodState != "Waiting" ] ; then 226 # Check pending REBUILDS 227 # ====================== 228 IGCM_check_CheckPendingRebuild 229 230 # Check last REBUILD and PACK* jobs 231 # ================================= 232 IGCM_check_CheckRebPackJobs 233 234 # Check last MONITORING jobs 235 # ========================== 236 IGCM_check_CheckMonitoring 237 238 # Check last ATLAS jobs 239 # ===================== 240 IGCM_check_CheckAtlas 241 242 # Time of last write on run.card 243 # ============================== 244 IGCM_sys_GetDate_FichWork ${SUBMIT_DIR}/run.card LastWrite "SplitFields" "${DateFormat}" 245 246 else 247 248 NbRebuild="." 249 FirstRebuild="." 250 LastRebuild="." 251 252 NbLines=0 253 254 fi 255 256 257 # Print results 258 # ============= 259 IGCM_check_PrintHeader 260 ind=0 261 while [ $ind -lt $NbLines ] ; do 262 IGCM_check_PrintJob 263 (( ind = ind + 1 )) 264 done 265 IGCM_check_PrintFooter 266 160 267 fi 161 268 162 if ( [ X${PeriodState} == XRunning ] || [ X${PeriodState} == XOnQueue ] ) ; then 163 #NbRun=$( ccc_mstat -f | grep -c ${JobName} ) 164 IGCM_sys_CountJobInQueue ${JobName} NbRun 165 166 if [ ${NbRun} -eq 0 ] ; then 167 PeriodState="Fatal" 168 fi 169 fi 170 171 DateBegin=${config_UserChoices_DateBegin} 172 DateEnd=${config_UserChoices_DateEnd} 173 TagName=${config_UserChoices_TagName} 174 ExperimentName=${config_UserChoices_ExperimentName} 175 SpaceName=${config_UserChoices_SpaceName} 176 177 178 if ( [ ! X${PeriodState} == XWaiting ] && [ ! X${PeriodState} == XCompleted ] ) ; then 179 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateBegin 180 IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateEnd 181 IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod 182 PeriodDateBegin=${run_Configuration_PeriodDateBegin} 183 PeriodDateEnd=${run_Configuration_PeriodDateEnd} 184 CumulPeriod=${run_Configuration_CumulPeriod} 185 else 186 PeriodDateBegin="." 187 PeriodDateEnd="." 188 CumulPeriod="." 189 fi 190 191 DATA_DIR=${R_SAVE} 192 POST_DIR=${R_BUFR}/Out 193 CWORK_DIR=${R_FIGR} 194 195 if [ ${TargetUsr} != ${CurrentUsr} ] ; then 196 DATA_DIR=$( IGCM_check_ChangeUsr ${DATA_DIR} ) 197 POST_DIR=$( IGCM_check_ChangeUsr ${POST_DIR} ) 198 CWORK_DIR=$( IGCM_check_ChangeUsr ${CWORK_DIR} ) 199 REBUILD_DIR=$( IGCM_check_ChangeUsr ${REBUILD_DIR} ) 200 fi 201 202 if [ $PeriodState != "Waiting" ] ; then 203 # Check pending REBUILDS 204 # ====================== 205 IGCM_check_CheckPendingRebuild 206 207 # Check last REBUILD and PACK* jobs 208 # ================================= 209 IGCM_check_CheckRebPackJobs 210 211 # Check last MONITORING jobs 212 # ========================== 213 IGCM_check_CheckMonitoring 214 215 # Check last ATLAS jobs 216 # ===================== 217 IGCM_check_CheckAtlas 218 219 # Time of last write on run.card 220 # ============================== 221 LastWrite=$( ls -l --time-style=+"${DateFormat}" ${SUBMIT_DIR}/run.card | gawk '{print $6 " " $7}' ) 222 223 else 224 225 NbRebuild="." 226 FirstRebuild="." 227 LastRebuild="." 228 229 NbLines=0 230 231 fi 232 233 234 # Print results 235 # ============= 236 IGCM_check_PrintHeader 237 ind=0 238 while [ $ind -lt $NbLines ] ; do 239 IGCM_check_PrintJob 240 (( ind = ind + 1 )) 241 done 242 IGCM_check_PrintFooter 243 244 fi 269 done -
trunk/libIGCM/libIGCM_check/libIGCM_check.ksh
r954 r955 136 136 SEARCH_DIR=${WORKDIR} 137 137 if [ ${TargetUsr} != ${CurrentUsr} ] ; then 138 echo $SEARCH_DIR139 138 SEARCH_DIR=$( IGCM_check_ChangeUsr ${SEARCH_DIR} ) 140 echo $SEARCH_DIR141 139 fi 142 140 echo "${JobName} not in Catalog, we'll try to find it in ${SEARCH_DIR}" … … 163 161 read Choice 164 162 if [ X${Choice} == Xq ] ; then 165 exit163 return 1 166 164 else 167 165 fg_new=true … … 173 171 case ${NbOcc} in 174 172 0) 175 echo "${JobName} not found." 173 if ( ${fg_search} ) ; then 174 echo "${JobName} not found, neither in catalog nor in \$WORKDIR." 175 else 176 echo "${JobName} not found in catalog." 177 fi 176 178 echo "You can try : *) '-s' option to automatically search your \$WORKDIR ; " 177 179 echo " *) '-p' option to provide the directory (absolute path) " 178 180 echo " containing the config.card ; " 179 181 echo " *) manually editing your ${SimuCatalog}." 180 exit;;182 return 1 ;; 181 183 1) 182 184 if ( ${fg_new} ) ; then … … 197 199 else 198 200 echo "${JobName} not in Catalog." 199 exit201 return 1 200 202 fi 201 203 ;; -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh
r948 r955 1535 1535 echo "IGCM_sys_GetDate_FichWork :" $@ 1536 1536 fi 1537 1538 if [ $# -ge 3 ] ; then 1539 mode=$3 1540 TimeStyle=$4 1541 else 1542 mode="default" 1543 TimeStyle="%Y%m%d%H%M%S" 1544 fi 1545 1537 1546 typeset dateF 1538 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1539 eval ${2}=${dateF[5]} 1547 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) 1548 1549 case $mode in 1550 "default") 1551 eval ${2}=${dateF[5]} 1552 ;; 1553 "SplitFields") 1554 eval ${2}="${dateF[5]}\ ${dateF[6]}" 1555 ;; 1556 esac 1557 1540 1558 1541 1559 # donne la date filesys d'un fichier sur la machine work … … 2018 2036 } 2019 2037 2038 #D-#================================================== 2039 #D-function IGCM_sys_ListJobInQueue 2040 #D-* Purpose: Check if job_name is currently 2041 #D- running or in queue 2042 #D-* Examples: IGCM_sys_ListJobInQueue ${User} JobNameList 2043 #D- 2044 function IGCM_sys_ListJobInQueue { 2045 IGCM_debug_PushStack "IGCM_sys_ListJobInQueue" 2046 if ( $DEBUG_sys ) ; then 2047 echo "IGCM_sys_ListJobInQueue" 2048 fi 2049 2050 # With -f option, the full job name is given in the last column 2051 set -A JobList $( llq -u $1 -W -f %jn | gawk '( $1 != /TS/ && \ 2052 $1 !~ /PACK/ && \ 2053 $1 !~ /REBUILD/ && \ 2054 $1 !~ /pack/ ) \ 2055 { print $1 }' | sed -e "s/\(.*\)\.[0-9]*/\1/" ) 2056 2057 eval set -A ${2} ${JobList[*]} 2058 2059 IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" 2060 } 2061 2020 2062 ############################################################## 2021 2063 # NCO OPERATOR -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
r948 r955 1682 1682 echo "IGCM_sys_GetDate_FichWork :" $@ 1683 1683 fi 1684 1685 if [ $# -ge 3 ] ; then 1686 mode=$3 1687 TimeStyle=$4 1688 else 1689 mode="default" 1690 TimeStyle="%Y%m%d%H%M%S" 1691 fi 1692 1684 1693 typeset dateF 1685 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1686 eval ${2}=${dateF[5]} 1694 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) 1695 1696 case $mode in 1697 "default") 1698 eval ${2}=${dateF[5]} 1699 ;; 1700 "SplitFields") 1701 eval ${2}="${dateF[5]}\ ${dateF[6]}" 1702 ;; 1703 esac 1704 1687 1705 1688 1706 # donne la date filesys d'un fichier sur la machine work … … 2337 2355 # With -f option, the full job name is given in the last column 2338 2356 NbRun=$( ccc_mstat -f | gawk -v JobName=$1 'BEGIN { x=0 } ( $NF ~ JobName ) { x=x+1 } END { print x }' ) 2357 set -A JobID= 2339 2358 2340 2359 eval ${2}=${NbRun} 2341 2360 2342 2361 IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" 2362 } 2363 2364 #D-#================================================== 2365 #D-function IGCM_sys_ListJobInQueue 2366 #D-* Purpose: Check if job_name is currently 2367 #D- running or in queue 2368 #D-* Examples: IGCM_sys_ListJobInQueue ${User} JobNameList 2369 #D- 2370 function IGCM_sys_ListJobInQueue { 2371 IGCM_debug_PushStack "IGCM_sys_ListJobInQueue" 2372 if ( $DEBUG_sys ) ; then 2373 echo "IGCM_sys_ListJobInQueue" 2374 fi 2375 2376 # With -f option, the full job name is given in the last column 2377 set -A JobList $( ccc_mstat -f | gawk -v User=$1 \ 2378 '( $2 == User && \ 2379 $NF != /TS/ && \ 2380 $NF !~ /PACK/ && \ 2381 $NF !~ /REBUILD/ && \ 2382 $NF !~ /pack/ ) \ 2383 { print $NF }' | sed -e "s/\(.*\)\.[0-9]*/\1/" ) 2384 2385 eval set -A ${2} ${JobList[*]} 2386 2387 IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" 2343 2388 } 2344 2389
Note: See TracChangeset
for help on using the changeset viewer.