1 | #!/bin/ksh |
---|
2 | |
---|
3 | #************************************************************** |
---|
4 | # Author: Sonia Labetoulle |
---|
5 | # Contact: sonia.labetoulle__at__ipsl.jussieu.fr |
---|
6 | # $Revision:: $ Revision of last commit |
---|
7 | # $Author:: $ Author of last commit |
---|
8 | # $Date:: $ Date of last commit |
---|
9 | # IPSL (2012) |
---|
10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
11 | # |
---|
12 | #************************************************************** |
---|
13 | # ID of your genci project. Curie only : post-processing jobs need it to run properly |
---|
14 | #-Q- curie export BRIDGE_MSUB_PROJECT=::default_project:: |
---|
15 | #-Q- irene export BRIDGE_MSUB_PROJECT=::default_project:: |
---|
16 | #-Q- irene-amd export BRIDGE_MSUB_PROJECT=::default_project:: |
---|
17 | |
---|
18 | #======================================================================# |
---|
19 | # Display a report on how a simulation is faring. |
---|
20 | |
---|
21 | |
---|
22 | #======================================================================# |
---|
23 | |
---|
24 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
25 | TaskType=checking |
---|
26 | typeset -i Verbosity=0 |
---|
27 | |
---|
28 | CurrentUsr=$( whoami ) |
---|
29 | |
---|
30 | if ( [ $# -eq 0 ] ) ; then |
---|
31 | $0 -h |
---|
32 | exit |
---|
33 | fi |
---|
34 | |
---|
35 | # Arguments |
---|
36 | # ========= |
---|
37 | # Default argument values |
---|
38 | #Â ----------------------- |
---|
39 | TargetUsr=${CurrentUsr} |
---|
40 | HostName=$( hostname | sed -e "s/[0-9].*//" ) |
---|
41 | |
---|
42 | fg_color=true |
---|
43 | fg_search=false |
---|
44 | fg_quiet=false |
---|
45 | fg_running=false |
---|
46 | fg_path=false |
---|
47 | NbHisto=20 |
---|
48 | |
---|
49 | # Get arguments from command line |
---|
50 | # ------------------------------- |
---|
51 | while getopts :hj:p:qsu:r Opt ; do |
---|
52 | case $Opt in |
---|
53 | h) |
---|
54 | echo "usage: $0 [-u user] [-q] [-j n] [-s] job_name [job_name2 ...]" |
---|
55 | echo " $0 [-u user] [-q] [-j n] -p config.card_path" |
---|
56 | echo " $0 [-u user] [-q] [-j n] -r [job_name job_name2 ...]" |
---|
57 | echo "" |
---|
58 | echo "options :" |
---|
59 | echo " -h : print this help and exit" |
---|
60 | echo " -u : owner of the job" |
---|
61 | echo " -q : quiet" |
---|
62 | echo " -j : print n post-processing jobs (default is 20)" |
---|
63 | echo " -s : search for a new job in \$WORKDIR and fill in " |
---|
64 | echo " the catalog before printing information" |
---|
65 | echo " -p : give the directory (absolute path) containing " |
---|
66 | echo " the config.card instead of the job name." |
---|
67 | echo " -r : check all running simulations." |
---|
68 | exit 0 ;; |
---|
69 | j) |
---|
70 | NbHisto=${OPTARG} |
---|
71 | ;; |
---|
72 | p) |
---|
73 | fg_path=true |
---|
74 | ConfigPath=${OPTARG} |
---|
75 | ;; |
---|
76 | q) |
---|
77 | fg_quiet=true |
---|
78 | ;; |
---|
79 | s) |
---|
80 | fg_search=true |
---|
81 | ;; |
---|
82 | u) |
---|
83 | TargetUsr=${OPTARG} |
---|
84 | ;; |
---|
85 | r) |
---|
86 | fg_running=true |
---|
87 | ;; |
---|
88 | :) |
---|
89 | echo "$0: -"${OPTARG}" option: missing value" |
---|
90 | exit 1 |
---|
91 | ;; |
---|
92 | \?) |
---|
93 | echo "$0: -"${OPTARG}" option: not supported" |
---|
94 | exit 1 |
---|
95 | ;; |
---|
96 | esac |
---|
97 | done |
---|
98 | shift $(($OPTIND-1)) |
---|
99 | |
---|
100 | # If no config.card path is given, and we're not looking for running simulations, |
---|
101 | # at least one JobName must be given. |
---|
102 | if ( ( ! ${fg_path} ) && ( ! ${fg_running} ) && [ $# -lt 1 ] ) ; then |
---|
103 | $0 -h |
---|
104 | exit |
---|
105 | fi |
---|
106 | |
---|
107 | if ( ( ${fg_path} ) && ( ${fg_search} ) ) ; then |
---|
108 | echo "You cannot use -s and -p at the same time" |
---|
109 | exit |
---|
110 | fi |
---|
111 | |
---|
112 | if ( ( ${fg_path} ) && ( ${fg_running} ) ) ; then |
---|
113 | echo "You cannot use -r and -p at the same time" |
---|
114 | exit |
---|
115 | fi |
---|
116 | |
---|
117 | |
---|
118 | # Load libIGCM library |
---|
119 | # ==================== |
---|
120 | libIGCM=${libIGCM:=::modipsl::/libIGCM} |
---|
121 | |
---|
122 | DEBUG_debug=false |
---|
123 | DEBUG_sys=false |
---|
124 | |
---|
125 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
126 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
127 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
128 | #------- |
---|
129 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
130 | . ${libIGCM}/libIGCM_check/libIGCM_check.ksh |
---|
131 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
132 | #------- |
---|
133 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
134 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
135 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
136 | |
---|
137 | |
---|
138 | if ( ${fg_running} ) ; then |
---|
139 | # Look for running simu |
---|
140 | IGCM_sys_ListJobInQueue ${TargetUsr} JobNameList |
---|
141 | fi |
---|
142 | |
---|
143 | if [ $# -ge 1 ] ; then |
---|
144 | set -A JobNameList ${JobNameList[*]} ${*} |
---|
145 | elif ( ${fg_path} ) ; then |
---|
146 | set -A JobNameList "Unknown" |
---|
147 | fi |
---|
148 | |
---|
149 | if [ ${#JobNameList[*]} -lt 1 ] ; then |
---|
150 | echo "No running simulation found." |
---|
151 | exit 0 |
---|
152 | fi |
---|
153 | |
---|
154 | |
---|
155 | if ( ${fg_quiet} ) ; then |
---|
156 | NbHisto=1 |
---|
157 | fi |
---|
158 | |
---|
159 | # Define the catalog in which the known simulations are stored |
---|
160 | # ============================================================ |
---|
161 | SimuCatalog="${HOME}/.simucatalog.dat" |
---|
162 | if [ ! -s ${SimuCatalog} ] ; then |
---|
163 | touch ${SimuCatalog} |
---|
164 | fi |
---|
165 | |
---|
166 | |
---|
167 | for JobName in ${JobNameList[*]} ; do |
---|
168 | |
---|
169 | # Find SUBMIT_DIR in catalog |
---|
170 | # ========================== |
---|
171 | IGCM_check_SearchCatalog |
---|
172 | Status=$? |
---|
173 | |
---|
174 | if [ $Status -eq 0 ] ; then |
---|
175 | |
---|
176 | IGCM_sys_Cd $SUBMIT_DIR |
---|
177 | |
---|
178 | |
---|
179 | # Extract usefull information from run.card and config.card |
---|
180 | # ========================================================= |
---|
181 | |
---|
182 | RunFile="${SUBMIT_DIR}/run.card" |
---|
183 | ConfFile="${SUBMIT_DIR}/config.card" |
---|
184 | |
---|
185 | IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card |
---|
186 | IGCM_check_CommonDef |
---|
187 | |
---|
188 | |
---|
189 | if [ -s ${RunFile} ] ; then |
---|
190 | IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodState |
---|
191 | PeriodState=${run_Configuration_PeriodState} |
---|
192 | else |
---|
193 | PeriodState="Waiting" |
---|
194 | fi |
---|
195 | |
---|
196 | JobID="." |
---|
197 | if ( [ X${PeriodState} == XRunning ] || [ X${PeriodState} == XOnQueue ] ) ; then |
---|
198 | IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID |
---|
199 | |
---|
200 | if [ "${JobID}" == "." ] || [ "${JobID}" == "" ] ; then |
---|
201 | PeriodState="Fatal" |
---|
202 | JobID="." |
---|
203 | fi |
---|
204 | fi |
---|
205 | |
---|
206 | DateBegin=${config_UserChoices_DateBegin} |
---|
207 | DateEnd=${config_UserChoices_DateEnd} |
---|
208 | TagName=${config_UserChoices_TagName} |
---|
209 | ExperimentName=${config_UserChoices_ExperimentName} |
---|
210 | SpaceName=${config_UserChoices_SpaceName} |
---|
211 | |
---|
212 | |
---|
213 | if ( [ ! X${PeriodState} == XWaiting ] && [ ! X${PeriodState} == XCompleted ] ) ; then |
---|
214 | IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateBegin |
---|
215 | IGCM_card_DefineVariableFromOption ${RunFile} Configuration PeriodDateEnd |
---|
216 | IGCM_card_DefineVariableFromOption ${RunFile} Configuration CumulPeriod |
---|
217 | PeriodDateBegin=${run_Configuration_PeriodDateBegin} |
---|
218 | PeriodDateEnd=${run_Configuration_PeriodDateEnd} |
---|
219 | CumulPeriod=${run_Configuration_CumulPeriod} |
---|
220 | else |
---|
221 | PeriodDateBegin="." |
---|
222 | PeriodDateEnd="." |
---|
223 | CumulPeriod="." |
---|
224 | fi |
---|
225 | |
---|
226 | DATA_DIR=${R_SAVE} |
---|
227 | POST_DIR=${R_BUFR}/Out |
---|
228 | CWORK_DIR=${R_FIGR} |
---|
229 | |
---|
230 | if [ ${TargetUsr} != ${CurrentUsr} ] ; then |
---|
231 | DATA_DIR=$( IGCM_check_ChangeUsr ${DATA_DIR} ) |
---|
232 | POST_DIR=$( IGCM_check_ChangeUsr ${POST_DIR} ) |
---|
233 | CWORK_DIR=$( IGCM_check_ChangeUsr ${CWORK_DIR} ) |
---|
234 | REBUILD_DIR=$( IGCM_check_ChangeUsr ${REBUILD_DIR} ) |
---|
235 | fi |
---|
236 | |
---|
237 | if [ $PeriodState != "Waiting" ] ; then |
---|
238 | # Check pending REBUILDS |
---|
239 | # ====================== |
---|
240 | IGCM_check_CheckPendingRebuild |
---|
241 | |
---|
242 | # Check last REBUILD and PACK* jobs |
---|
243 | # ================================= |
---|
244 | IGCM_check_CheckRebPackJobs |
---|
245 | |
---|
246 | # Check last MONITORING jobs |
---|
247 | # ========================== |
---|
248 | IGCM_check_CheckMonitoring |
---|
249 | |
---|
250 | # Check last ATLAS jobs |
---|
251 | # ===================== |
---|
252 | IGCM_check_CheckAtlas |
---|
253 | |
---|
254 | # Time of last write on run.card |
---|
255 | # ============================== |
---|
256 | IGCM_sys_GetDate_FichWork ${SUBMIT_DIR}/run.card LastWrite "SplitFields" "${DateFormat}" |
---|
257 | |
---|
258 | else |
---|
259 | |
---|
260 | NbRebuild="." |
---|
261 | FirstRebuild="." |
---|
262 | LastRebuild="." |
---|
263 | |
---|
264 | NbLines=0 |
---|
265 | |
---|
266 | fi |
---|
267 | |
---|
268 | |
---|
269 | # Print results |
---|
270 | # ============= |
---|
271 | IGCM_check_PrintHeader |
---|
272 | ind=0 |
---|
273 | while [ $ind -lt $NbLines ] ; do |
---|
274 | IGCM_check_PrintJob |
---|
275 | (( ind = ind + 1 )) |
---|
276 | done |
---|
277 | IGCM_check_PrintFooter |
---|
278 | |
---|
279 | fi |
---|
280 | |
---|
281 | done |
---|