1 | #!/bin/ksh |
---|
2 | |
---|
3 | #************************************************************** |
---|
4 | # Author: Sebastien Denvil, Martial Mancip |
---|
5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr Martial.Mancip__at__ipsl.jussieu.fr |
---|
6 | # $Revision:: $ Revision of last commit |
---|
7 | # $Author:: $ Author of last commit |
---|
8 | # $Date:: $ Date of last commit |
---|
9 | # IPSL (2006) |
---|
10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
11 | # |
---|
12 | #************************************************************** |
---|
13 | |
---|
14 | #=================================== |
---|
15 | function IGCM_config_Initialize |
---|
16 | { |
---|
17 | IGCM_debug_PushStack "IGCM_config_Initialize" |
---|
18 | |
---|
19 | # Debug Print : |
---|
20 | echo |
---|
21 | IGCM_debug_Print 1 "IGCM_config_Initialize :" |
---|
22 | echo |
---|
23 | |
---|
24 | if [ ! -r ${SUBMIT_DIR}/run.card ]; then |
---|
25 | #================================================# |
---|
26 | # The file run.card doesn't exist # |
---|
27 | #================================================# |
---|
28 | FirstInitialize=true |
---|
29 | #copy initial run.card |
---|
30 | IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card |
---|
31 | else |
---|
32 | FirstInitialize=false |
---|
33 | fi |
---|
34 | |
---|
35 | # Test modipsl tree existence. |
---|
36 | IGCM_sys_TestDir ${MODIPSL} |
---|
37 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
38 | IGCM_sys_TestDir ${libIGCM} |
---|
39 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
40 | IGCM_sys_TestDir ${R_EXE} |
---|
41 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
42 | IGCM_sys_TestDir ${SUBMIT_DIR} |
---|
43 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
44 | |
---|
45 | if ( $DEBUG_debug ) ; then |
---|
46 | echo "Keep trace of inital SUBMIT_DIR : " |
---|
47 | ls -lta ${SUBMIT_DIR} |
---|
48 | fi |
---|
49 | |
---|
50 | #================================== |
---|
51 | |
---|
52 | typeset option auxprint CompatibilityTag |
---|
53 | # Read libIGCM compatibility version in config.card |
---|
54 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM |
---|
55 | eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1 |
---|
56 | |
---|
57 | if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then |
---|
58 | IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." |
---|
59 | fi |
---|
60 | |
---|
61 | #================================== |
---|
62 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices |
---|
63 | |
---|
64 | for option in ${config_UserChoices[*]} ; do |
---|
65 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} |
---|
66 | done |
---|
67 | |
---|
68 | IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" |
---|
69 | # Name Space of this experience |
---|
70 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
71 | IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName |
---|
72 | fi |
---|
73 | # Expericence class of the run |
---|
74 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
75 | IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName |
---|
76 | fi |
---|
77 | IGCM_debug_PrintVariables 3 config_UserChoices_JobName |
---|
78 | if [ 3 -le ${Verbosity} ] ; then |
---|
79 | echo "--------------Debug3-->" "config_UserChoices_LongName=" |
---|
80 | echo "--------------Debug3-->" \"${config_UserChoices_LongName}\" |
---|
81 | fi |
---|
82 | IGCM_debug_PrintVariables 3 config_UserChoices_TagName |
---|
83 | IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType |
---|
84 | IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin |
---|
85 | IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd |
---|
86 | IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength |
---|
87 | |
---|
88 | #================================== |
---|
89 | |
---|
90 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents |
---|
91 | |
---|
92 | echo |
---|
93 | IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" |
---|
94 | IGCM_debug_Print 3 ${config_ListOfComponents[*]} |
---|
95 | echo |
---|
96 | |
---|
97 | NbComponents=${#config_ListOfComponents[*]} |
---|
98 | |
---|
99 | #================================== |
---|
100 | # Define principal executable |
---|
101 | |
---|
102 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable |
---|
103 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name |
---|
104 | |
---|
105 | #================================== |
---|
106 | # Define Outputs Name |
---|
107 | IGCM_debug_Print 1 "Define Script_Output_Prefix and Exe_Output" |
---|
108 | eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} |
---|
109 | IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" |
---|
110 | eval Exe_Output=out_${config_Executable_Name} |
---|
111 | IGCM_debug_Print 3 "Exe_Output = ${Exe_Output}" |
---|
112 | |
---|
113 | #================================== |
---|
114 | |
---|
115 | #===================================================================# |
---|
116 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
117 | # But available to any son functions # |
---|
118 | #===================================================================# |
---|
119 | |
---|
120 | # Convert yyyy-mm-dd date to gregorian yyyymmdd |
---|
121 | DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) |
---|
122 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
123 | |
---|
124 | # Period Length In Days between DateBegin and DateEnd |
---|
125 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
126 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
127 | IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
128 | IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." |
---|
129 | IGCM_debug_Verif_Exit |
---|
130 | fi |
---|
131 | |
---|
132 | # Day and Year of Initial State (Given in julian format) |
---|
133 | InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )) |
---|
134 | InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )) |
---|
135 | |
---|
136 | #================================== |
---|
137 | # Restarts : Gerneral rule or local for each component ? |
---|
138 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts |
---|
139 | |
---|
140 | echo |
---|
141 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts" |
---|
142 | |
---|
143 | for option in ${config_Restarts[*]} ; do |
---|
144 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option} |
---|
145 | eval auxprint=\${config_Restarts_${option}} |
---|
146 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
147 | done |
---|
148 | |
---|
149 | #================================================================# |
---|
150 | # Test and Prepare directories # |
---|
151 | #================================================================# |
---|
152 | |
---|
153 | # ==> 4 kinds of input files : |
---|
154 | # 1) R_INIT : Initial State Files (Etat0, carteveg) |
---|
155 | # 2) R_BC : Boundary Conditions (Forcages, lai) |
---|
156 | # 3) Parameters files (allready define through ${SUBMIT_DIR}) |
---|
157 | # 4) Restarts files (allready define in IGCM_config_Initialize) |
---|
158 | |
---|
159 | # Here we offer the possibility to redefine R_INIT, R_BC |
---|
160 | # and PeriodNb through config.card |
---|
161 | R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} |
---|
162 | echo |
---|
163 | IGCM_debug_Print 1 "(Re)Define R_INIT, R_BC and PeriodNb" |
---|
164 | IGCM_debug_Print 3 "R_INIT=${R_INIT}" |
---|
165 | R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} |
---|
166 | IGCM_debug_Print 3 "R_BC=${R_BC}" |
---|
167 | PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}} |
---|
168 | IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" |
---|
169 | |
---|
170 | # Test Archive input/output. |
---|
171 | IGCM_sys_TestDirArchive ${ARCHIVE} |
---|
172 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
173 | IGCM_sys_TestDirArchive ${R_IN} |
---|
174 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
175 | |
---|
176 | #==================================================== |
---|
177 | #R_SAVE : Job output directory |
---|
178 | if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then |
---|
179 | FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) |
---|
180 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
181 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
182 | else |
---|
183 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
184 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
185 | fi |
---|
186 | |
---|
187 | if [ ! -f ${SUBMIT_DIR}/run.card ]; then |
---|
188 | IGCM_sys_MkdirArchive ${R_SAVE} |
---|
189 | else |
---|
190 | #Test state of run in run.card |
---|
191 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
192 | if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
193 | echo |
---|
194 | IGCM_debug_Print 1 "!!!! IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!" |
---|
195 | echo |
---|
196 | IGCM_debug_Exit "IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState} |
---|
197 | IGCM_debug_Verif_Exit |
---|
198 | fi |
---|
199 | fi |
---|
200 | IGCM_sys_TestDirArchive ${R_SAVE} |
---|
201 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
202 | |
---|
203 | #================================== |
---|
204 | # Post : |
---|
205 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post |
---|
206 | |
---|
207 | echo |
---|
208 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Post" |
---|
209 | |
---|
210 | for option in ${config_Post[*]} ; do |
---|
211 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option} |
---|
212 | eval auxprint=\${config_Post_${option}} |
---|
213 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
214 | done |
---|
215 | |
---|
216 | #==================================================== |
---|
217 | # Define REBUILD_DIR : where we store files needing rebuild process |
---|
218 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
219 | REBUILD_DIR=${R_SAVE}/TMP |
---|
220 | IGCM_sys_MkdirArchive ${REBUILD_DIR} |
---|
221 | else |
---|
222 | REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
223 | IGCM_sys_MkdirWork ${REBUILD_DIR} |
---|
224 | fi |
---|
225 | |
---|
226 | #==================================================== |
---|
227 | # Experience type : DEB(ug), DEV(elopment), RUN |
---|
228 | if [ X${JobType} != XRUN ] ; then |
---|
229 | echo |
---|
230 | echo "====================================================" |
---|
231 | echo "libIGCM JOB is NOT in RUN type mode." |
---|
232 | echo "!! OUTPUT files will NOT be PROTECTED !!" |
---|
233 | echo "Be carefull : you can ERASE the result of this job !" |
---|
234 | |
---|
235 | case ${JobType} in |
---|
236 | DEB) |
---|
237 | echo "DEBUG mode : activation of 'set -vx' mode." |
---|
238 | echo "DEBUG mode : no protection for output files." |
---|
239 | echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
240 | ;; |
---|
241 | DEV) |
---|
242 | echo "DEVelopment mode : no protection for output files." |
---|
243 | echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
244 | ;; |
---|
245 | esac |
---|
246 | |
---|
247 | if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then |
---|
248 | if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then |
---|
249 | echo "------------" |
---|
250 | echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" |
---|
251 | echo " to PeriodLength : ${config_UserChoices_PeriodLength}" |
---|
252 | echo "------------" |
---|
253 | config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} |
---|
254 | fi |
---|
255 | fi |
---|
256 | echo "====================================================" |
---|
257 | echo |
---|
258 | fi |
---|
259 | |
---|
260 | #==================================================== |
---|
261 | #R_OUT_KSH : Storage place for job output |
---|
262 | #R_OUT_EXE : Storage place for binary used during simulation |
---|
263 | R_OUT_KSH=${R_SAVE}/Out |
---|
264 | R_OUT_EXE=${R_SAVE}/Exe |
---|
265 | |
---|
266 | IGCM_debug_PopStack "IGCM_config_Initialize" |
---|
267 | } |
---|
268 | |
---|
269 | #=================================== |
---|
270 | function IGCM_config_Analyse_PeriodLength |
---|
271 | { |
---|
272 | IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength" |
---|
273 | |
---|
274 | typeset i |
---|
275 | |
---|
276 | # Determine number of day(s) in PeriodLength : |
---|
277 | case ${config_UserChoices_PeriodLength} in |
---|
278 | *Y|*y) |
---|
279 | PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) |
---|
280 | IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" |
---|
281 | PeriodLengthInDays=0 |
---|
282 | i=0 |
---|
283 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
284 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) |
---|
285 | (( i=i+1 )) |
---|
286 | done |
---|
287 | ;; |
---|
288 | *M|*m) |
---|
289 | PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) |
---|
290 | IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" |
---|
291 | PeriodLengthInDays=0 |
---|
292 | i=0 |
---|
293 | until [ $i -ge $PeriodLengthInMonths ] ; do |
---|
294 | if [ $(( month + i )) -lt 13 ] ; then |
---|
295 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) |
---|
296 | else |
---|
297 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) |
---|
298 | fi |
---|
299 | (( i=i+1 )) |
---|
300 | done |
---|
301 | ;; |
---|
302 | *D|*d) |
---|
303 | PeriodLengthInMonths=0 |
---|
304 | PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );; |
---|
305 | *) |
---|
306 | IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." |
---|
307 | IGCM_debug_Verif_Exit ;; |
---|
308 | esac |
---|
309 | |
---|
310 | IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" |
---|
311 | } |
---|
312 | |
---|
313 | #=================================== |
---|
314 | function IGCM_config_Check |
---|
315 | { |
---|
316 | IGCM_debug_PushStack "IGCM_config_Check" |
---|
317 | |
---|
318 | # If one of the following modulo is not zero : |
---|
319 | # we will issue an error then explain and exit in |
---|
320 | # AA_job IGCM_debug_Verif_Exit call before binary submission |
---|
321 | |
---|
322 | echo |
---|
323 | IGCM_debug_Print 1 "IGCM_config_Check :" |
---|
324 | echo |
---|
325 | |
---|
326 | typeset i |
---|
327 | |
---|
328 | if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then |
---|
329 | AsynchronousRebuild=true |
---|
330 | IGCM_debug_Print 1 "Asynchronous rebuild has been activated." |
---|
331 | echo |
---|
332 | # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero |
---|
333 | IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength |
---|
334 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency |
---|
335 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency |
---|
336 | else |
---|
337 | AsynchronousRebuild=false |
---|
338 | IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" |
---|
339 | IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" |
---|
340 | echo |
---|
341 | #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero |
---|
342 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength |
---|
343 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength |
---|
344 | fi |
---|
345 | |
---|
346 | #modulo (TimeSeriesFrequency and all Chunck2D) must be zero |
---|
347 | NbJob=${#CHUNCK2D_SIZE[@]} |
---|
348 | i=0 |
---|
349 | until [ $i -ge $NbJob ]; do |
---|
350 | value=${CHUNCK2D_SIZE[${i}]} |
---|
351 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
352 | case ${value} in |
---|
353 | *Y|*y) ;; |
---|
354 | *) IGCM_debug_Print 3 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" |
---|
355 | IGCM_debug_Exit "This will stop the job" ;; |
---|
356 | esac |
---|
357 | (( i=i+1 )) |
---|
358 | done |
---|
359 | |
---|
360 | #modulo (TimeSeriesFrequency and all Chunck3D) must be zero |
---|
361 | NbJob=${#CHUNCK3D_SIZE[@]} |
---|
362 | i=0 |
---|
363 | until [ $i -ge $NbJob ]; do |
---|
364 | value=${CHUNCK3D_SIZE[${i}]} |
---|
365 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
366 | case ${value} in |
---|
367 | *Y|*y) ;; |
---|
368 | *) IGCM_debug_Print 3 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" |
---|
369 | IGCM_debug_Exit "This will stop the job" ;; |
---|
370 | esac |
---|
371 | (( i=i+1 )) |
---|
372 | done |
---|
373 | |
---|
374 | IGCM_debug_PopStack "IGCM_config_Check" |
---|
375 | } |
---|
376 | |
---|
377 | #=================================== |
---|
378 | function IGCM_config_PeriodStart |
---|
379 | { |
---|
380 | IGCM_debug_PushStack "IGCM_config_PeriodStart" |
---|
381 | |
---|
382 | echo |
---|
383 | IGCM_debug_Print 1 "IGCM_config_PeriodStart :" |
---|
384 | echo |
---|
385 | |
---|
386 | if ( ${FirstInitialize} ) ; then |
---|
387 | #================================================# |
---|
388 | # Initialize date/period information # |
---|
389 | #================================================# |
---|
390 | |
---|
391 | IGCM_date_GetYearMonth $DateBegin year month |
---|
392 | year_m1=$(( year - 1 )) |
---|
393 | year_p1=$(( year + 1 )) |
---|
394 | IGCM_config_Analyse_PeriodLength |
---|
395 | |
---|
396 | eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1 |
---|
397 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
398 | eval CumulPeriod=1 > /dev/null 2>&1 |
---|
399 | |
---|
400 | #=================================================# |
---|
401 | # Write updated run.card # |
---|
402 | #=================================================# |
---|
403 | |
---|
404 | #Correct run.card Configuration for this period |
---|
405 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
406 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
407 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
408 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR} |
---|
409 | |
---|
410 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
411 | |
---|
412 | # It's no more the first time |
---|
413 | FirstInitialize=false |
---|
414 | else |
---|
415 | #================================================# |
---|
416 | # The file run.card allready exist # |
---|
417 | #================================================# |
---|
418 | |
---|
419 | #Test state of run in run.card |
---|
420 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
421 | if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
422 | echo |
---|
423 | IGCM_debug_Print 1 "!!!!!! IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!" |
---|
424 | echo |
---|
425 | IGCM_debug_Exit "IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState} |
---|
426 | IGCM_debug_Verif_Exit |
---|
427 | fi |
---|
428 | |
---|
429 | #===================================# |
---|
430 | # Read updated run.card # |
---|
431 | #===================================# |
---|
432 | |
---|
433 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix |
---|
434 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin |
---|
435 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd |
---|
436 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod |
---|
437 | |
---|
438 | PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) |
---|
439 | PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) |
---|
440 | eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1 |
---|
441 | |
---|
442 | if [ ${Period} = 1 ]; then |
---|
443 | # save last Job output |
---|
444 | typeset LastPeriod iLastPeriod Last_Script_Output_Name |
---|
445 | (( LastPeriod=CumulPeriod-PeriodNb )) |
---|
446 | iLastPeriod=$( printf "%06d" ${LastPeriod} ) |
---|
447 | Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}" |
---|
448 | Last_run_card="run.card.${iLastPeriod}" |
---|
449 | #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name} |
---|
450 | #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1 |
---|
451 | IGCM_debug_Print 1 "Try to save previous ksh job output" |
---|
452 | IGCM_sys_Cd ${SUBMIT_DIR}/ |
---|
453 | IGCM_sys_Put_Out ${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name}.$$ rw |
---|
454 | IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/${Last_run_card}.$$ rw |
---|
455 | IGCM_sys_Cd ${RUN_DIR} |
---|
456 | else |
---|
457 | unset FileToBeDeleted |
---|
458 | fi |
---|
459 | |
---|
460 | IGCM_date_GetYearMonth $PeriodDateBegin year month |
---|
461 | year_m1=$(( year - 1 )) |
---|
462 | year_p1=$(( year + 1 )) |
---|
463 | IGCM_config_Analyse_PeriodLength |
---|
464 | |
---|
465 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
466 | |
---|
467 | fi |
---|
468 | OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} |
---|
469 | |
---|
470 | #===================================================================# |
---|
471 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
472 | # But available to any son functions # |
---|
473 | #===================================================================# |
---|
474 | |
---|
475 | # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !) |
---|
476 | (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 )) |
---|
477 | |
---|
478 | # Debug Print : |
---|
479 | IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" |
---|
480 | IGCM_debug_Print 3 "Year of simulation : ${year}" |
---|
481 | IGCM_debug_Print 3 "Month of simulation : ${month}" |
---|
482 | IGCM_debug_Print 3 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
483 | IGCM_debug_Print 3 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
484 | IGCM_debug_Print 3 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
485 | IGCM_debug_Print 3 "SimulationLengthInDays : ${SimulationLengthInDays}" |
---|
486 | IGCM_debug_Print 3 "ExperienceLengthInDays : ${ExperienceLengthInDays}" |
---|
487 | |
---|
488 | #================================================================# |
---|
489 | # Prepare variables available for comp_finalyze # |
---|
490 | #================================================================# |
---|
491 | |
---|
492 | # Period for save files |
---|
493 | eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1 |
---|
494 | |
---|
495 | # Prefix for save files of this period |
---|
496 | eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod} > /dev/null 2>&1 |
---|
497 | |
---|
498 | # List of files that will be deleted in RUN_DIR after run |
---|
499 | [ -f stack ] && FileToBeDeleted[0]="stack" |
---|
500 | |
---|
501 | # Test if the same run as already been saved : |
---|
502 | if [ X${JobType} = XRUN ] ; then |
---|
503 | if [ ${DRYRUN} -le 0 ] ; then |
---|
504 | if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
505 | IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." |
---|
506 | IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" |
---|
507 | IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " |
---|
508 | IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." |
---|
509 | IGCM_debug_Print 1 " This exit has been initiated because at least ${R_OUT_KSH}/${PREFIX}_${Exe_Output} exists." |
---|
510 | IGCM_debug_Verif_Exit |
---|
511 | fi |
---|
512 | fi |
---|
513 | else |
---|
514 | if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
515 | IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. DEBUG of DEV mode." |
---|
516 | fi |
---|
517 | fi |
---|
518 | |
---|
519 | IGCM_debug_PopStack "IGCM_config_PeriodStart" |
---|
520 | } |
---|
521 | |
---|
522 | #=================================== |
---|
523 | function IGCM_config_PeriodEnd |
---|
524 | { |
---|
525 | IGCM_debug_PushStack "IGCM_config_PeriodEnd" |
---|
526 | |
---|
527 | echo |
---|
528 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd :" |
---|
529 | echo |
---|
530 | |
---|
531 | #==================================# |
---|
532 | # Save Job output # |
---|
533 | #==================================# |
---|
534 | IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output} |
---|
535 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}" |
---|
536 | |
---|
537 | IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card rw |
---|
538 | |
---|
539 | typeset LS_comp LS_bin ExeDate ExeCpuLog ExeSize NextExeSize LastCompExeSize |
---|
540 | typeset comp i |
---|
541 | typeset ExeNameIn ExeNameOut |
---|
542 | |
---|
543 | #==================================# |
---|
544 | # Get last Exe Size # |
---|
545 | #==================================# |
---|
546 | |
---|
547 | if [ ${DRYRUN} -le 1 ] ; then |
---|
548 | (( i=0 )) |
---|
549 | if ( ${FirstInitialize} ) ; then |
---|
550 | run_Log_LastExeSize="" |
---|
551 | for comp in ${config_ListOfComponents[*]} ; do |
---|
552 | run_Log_LastExeSize[$i]=0 |
---|
553 | (( i=i+1 )) |
---|
554 | done |
---|
555 | else |
---|
556 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize |
---|
557 | fi |
---|
558 | fi |
---|
559 | #==================================# |
---|
560 | # And Build ExeDate # |
---|
561 | #==================================# |
---|
562 | |
---|
563 | # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33 |
---|
564 | # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M") |
---|
565 | # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34 |
---|
566 | ExeDate="" |
---|
567 | NextExeSize="( " |
---|
568 | (( i=0 )) |
---|
569 | |
---|
570 | for comp in ${config_ListOfComponents[*]} ; do |
---|
571 | |
---|
572 | IGCM_debug_Print 1 ${comp} |
---|
573 | |
---|
574 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
575 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
576 | # Only if we really have an executable for the component : |
---|
577 | if [ X${ExeNameIn} = X\"\" ] ; then |
---|
578 | # If there is no exe file for this component |
---|
579 | (( ExeSize=0 )) |
---|
580 | else |
---|
581 | eval LS_bin=${R_EXE}/${ExeNameIn} |
---|
582 | IGCM_sys_FileSize ${LS_bin} ExeSize |
---|
583 | |
---|
584 | set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) |
---|
585 | if [ X${ExeDate} = X ] ; then |
---|
586 | # First component exe date |
---|
587 | ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
588 | else |
---|
589 | ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
590 | fi |
---|
591 | ExeDate=${ExeDate}_${LS_comp[7]} |
---|
592 | fi |
---|
593 | |
---|
594 | if [ ${i} -eq 0 ] ; then |
---|
595 | # First component |
---|
596 | NextExeSize="( "${ExeSize} |
---|
597 | else |
---|
598 | NextExeSize=${NextExeSize}", "${ExeSize} |
---|
599 | fi |
---|
600 | eval LastCompExeSize=${run_Log_LastExeSize[$i]} |
---|
601 | (( i=i+1 )) |
---|
602 | |
---|
603 | if [ ${DRYRUN} -le 1 ] ; then |
---|
604 | if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then |
---|
605 | if ( ${FirstInitialize} ) ; then |
---|
606 | IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" |
---|
607 | else |
---|
608 | IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" |
---|
609 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} |
---|
610 | fi |
---|
611 | eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw |
---|
612 | fi |
---|
613 | fi |
---|
614 | done |
---|
615 | |
---|
616 | if [ ${DRYRUN} -le 1 ] ; then |
---|
617 | tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt |
---|
618 | ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) |
---|
619 | RET=$? |
---|
620 | if [ $RET -eq 0 ] ; then |
---|
621 | # ExeCpuLog variable contents 5 fields |
---|
622 | echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" | \ |
---|
623 | gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ |
---|
624 | $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card |
---|
625 | fi |
---|
626 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" |
---|
627 | fi |
---|
628 | |
---|
629 | NextExeSize=${NextExeSize}" )" |
---|
630 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" |
---|
631 | |
---|
632 | # All was right ? no ? then we stop. |
---|
633 | IGCM_debug_Verif_Exit |
---|
634 | |
---|
635 | # If all was OK, we can delete all files not necessary for next Job |
---|
636 | IGCM_debug_Print 1 "Files that will be deleted before next period-run : " |
---|
637 | |
---|
638 | if [ ${DRYRUN} -le 2 ] ; then |
---|
639 | for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done |
---|
640 | else |
---|
641 | echo ${FileToBeDeleted[@]} |
---|
642 | fi |
---|
643 | |
---|
644 | #=================================================# |
---|
645 | # Modification of libIGCM behaviour # |
---|
646 | #=================================================# |
---|
647 | |
---|
648 | # To use this function, one must copy libIGCM.card from ${libIGCM} directory |
---|
649 | # and put it in ${SUBMIT_DIR} directory. Ater modifications of ${SUBMIT_DIR}/libIGCM.card, |
---|
650 | # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. |
---|
651 | if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then |
---|
652 | echo |
---|
653 | echo "########################################################################" |
---|
654 | echo "!!! Modification of libIGCM behaviour !!!" |
---|
655 | echo |
---|
656 | |
---|
657 | IGCM_debug_Print 1 "DefineArrayFromOption : libIGCM_UserChanges in libIGCM.card" |
---|
658 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges |
---|
659 | IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} |
---|
660 | |
---|
661 | # Special treatments for libIGCM internals |
---|
662 | for option in ${libIGCM_UserChanges[*]} ; do |
---|
663 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} |
---|
664 | |
---|
665 | echo "We will change : ${option}." |
---|
666 | eval echo "Previous value : " \${${option}} |
---|
667 | eval echo "Change to : " \${libIGCM_UserChanges_${option}} |
---|
668 | |
---|
669 | eval ${option}=\${libIGCM_UserChanges_${option}} |
---|
670 | |
---|
671 | case ${option} in |
---|
672 | config_UserChoices_DateEnd) |
---|
673 | IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd |
---|
674 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
675 | |
---|
676 | # Period Length In Days between DateBegin and DateEnd |
---|
677 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
678 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
679 | IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
680 | IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates." |
---|
681 | IGCM_debug_Verif_Exit |
---|
682 | fi |
---|
683 | ;; |
---|
684 | config_UserChoices_PeriodLength) |
---|
685 | ;; |
---|
686 | PeriodNb) |
---|
687 | IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" |
---|
688 | ;; |
---|
689 | config_Post_RebuildFrequency) |
---|
690 | IGCM_debug_Print 3 "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" |
---|
691 | IGCM_post_Configure |
---|
692 | ;; |
---|
693 | config_Post_TimeSeriesFrequency) |
---|
694 | IGCM_debug_Print 3 "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" |
---|
695 | IGCM_post_Configure |
---|
696 | ;; |
---|
697 | config_Post_SeasonalFrequency) |
---|
698 | IGCM_debug_Print 3 "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" |
---|
699 | IGCM_post_Configure |
---|
700 | ;; |
---|
701 | esac |
---|
702 | done |
---|
703 | |
---|
704 | echo |
---|
705 | echo "########################################################################" |
---|
706 | echo |
---|
707 | fi |
---|
708 | |
---|
709 | #=================================================# |
---|
710 | # Determine next computed period # |
---|
711 | #=================================================# |
---|
712 | |
---|
713 | PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 ) |
---|
714 | IGCM_date_GetYearMonth $PeriodDateBegin year month |
---|
715 | year_m1=$(( year - 1 )) |
---|
716 | year_p1=$(( year + 1 )) |
---|
717 | IGCM_config_Analyse_PeriodLength |
---|
718 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
719 | |
---|
720 | # Debug Print : |
---|
721 | echo |
---|
722 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution" |
---|
723 | IGCM_debug_Print 3 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
724 | IGCM_debug_Print 3 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
725 | IGCM_debug_Print 3 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
726 | |
---|
727 | PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} ) |
---|
728 | PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} ) |
---|
729 | |
---|
730 | (( CumulPeriod = CumulPeriod + 1 )) |
---|
731 | |
---|
732 | # Debug Print : |
---|
733 | echo |
---|
734 | IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}" |
---|
735 | IGCM_debug_Print 3 "PeriodDateEnd Human : ${PeriodDateEnd}" |
---|
736 | IGCM_debug_Print 3 "CumulPeriod : ${CumulPeriod}" |
---|
737 | |
---|
738 | #=================================================# |
---|
739 | # Write updated run.card # |
---|
740 | #=================================================# |
---|
741 | |
---|
742 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix} |
---|
743 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
744 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
745 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
746 | |
---|
747 | IGCM_debug_PopStack "IGCM_config_PeriodEnd" |
---|
748 | } |
---|
749 | |
---|
750 | #=================================== |
---|
751 | function IGCM_config_Finalize |
---|
752 | { |
---|
753 | IGCM_debug_PushStack "IGCM_config_Finalize" |
---|
754 | |
---|
755 | echo |
---|
756 | IGCM_debug_Print 1 "IGCM_config_Finalize :" |
---|
757 | echo |
---|
758 | |
---|
759 | if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then |
---|
760 | #==========================# |
---|
761 | # End of entire simulation # |
---|
762 | #==========================# |
---|
763 | |
---|
764 | # Mail notification |
---|
765 | IGCM_sys_SendMail |
---|
766 | |
---|
767 | # |
---|
768 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed" |
---|
769 | IGCM_debug_Print 1 "Normal End of computation." |
---|
770 | if ( $DEBUG_debug ) ; then |
---|
771 | echo |
---|
772 | IGCM_debug_Print 1 "Your files on ${R_OUT} :" |
---|
773 | IGCM_sys_Tree ${R_SAVE} |
---|
774 | fi |
---|
775 | else |
---|
776 | #=================# |
---|
777 | # Submit next job # |
---|
778 | #=================# |
---|
779 | |
---|
780 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" |
---|
781 | |
---|
782 | # Name of next Ksh Script output : |
---|
783 | eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )" |
---|
784 | |
---|
785 | IGCM_debug_Print 1 "Submit next job" |
---|
786 | # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR |
---|
787 | IGCM_sys_Cd ${SUBMIT_DIR} |
---|
788 | # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} |
---|
789 | ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l ) |
---|
790 | [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) |
---|
791 | # Submit next job and come back |
---|
792 | IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} |
---|
793 | IGCM_sys_Cd - |
---|
794 | fi |
---|
795 | |
---|
796 | # Supress Non Deleted Boundary files |
---|
797 | if [ ${DRYRUN} -le 2 ] ; then |
---|
798 | IGCM_comp_DelFixeBoundaryFiles |
---|
799 | ls -la |
---|
800 | fi |
---|
801 | |
---|
802 | # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
803 | # Only for production run (No clean up in DEV or DEB mode) |
---|
804 | # and command sent from .. directory. |
---|
805 | IGCM_sys_Cd .. |
---|
806 | [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR} |
---|
807 | |
---|
808 | IGCM_debug_PopStack "IGCM_config_Finalize" |
---|
809 | } |
---|
810 | |
---|
811 | #=================================== |
---|