source: trunk/libIGCM/AA_SE_Checker @ 386

Last change on this file since 386 was 386, checked in by mafoipsl, 14 years ago

Add ulam header to facilitate post-processing on ulam directly.

  • Property svn:keywords set to Revision Author Date
File size: 13.6 KB
Line 
1#!/bin/ksh
2#-Q- cesium #!/bin/ksh
3#-Q- cesium ######################
4#-Q- cesium ## CESIUM   CEA ##
5#-Q- cesium ######################
6#-Q- cesium #MSUB -r SE_Checker             # Nom du job               
7#-Q- cesium #MSUB -N 1              # Reservation du noeud
8#-Q- cesium #MSUB -n 1              # Reservation du processus
9#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
10#-Q- cesium #MSUB -E "-j o"
11#-Q- cesium #MSUB -E "-S /bin/ksh"
12#-Q- platine #!/usr/bin/ksh
13#-Q- platine ###################
14#-Q- platine ## PLATINE   CEA ##
15#-Q- platine ###################
16#-Q- platine #BSUB -J SE_Checker                     # Nom du job
17#-Q- platine #BSUB -N                        # message a la fin du job
18#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
19#-Q- platine #BSUB -W 1:00                   # Limite temps
20#-Q- platine #BSUB -q post                   # Passage en queue post
21#-Q- sx8brodie #!/bin/ksh
22#-Q- sx8brodie #######################
23#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
24#-Q- sx8brodie #######################
25#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
26#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
27#-Q- sx8brodie # Nom du travail LoadLeveler
28#-Q- sx8brodie # @ job_name   = SE_Checker
29#-Q- sx8brodie # Fichier de sortie standard du travail       
30#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
31#-Q- sx8brodie # Fichier de sortie d'erreur du travail
32#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
33#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
34#-Q- sx8brodie # @ notification = error
35#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
36#-Q- sx8brodie # @ queue
37#-Q- aix6 #!/bin/ksh
38#-Q- aix6 #######################
39#-Q- aix6 ##   VARGAS   IDRIS  ##
40#-Q- aix6 #######################
41#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
42#-Q- aix6 # @ wall_clock_limit = 20:00:00
43#-Q- aix6 # Nom du travail LoadLeveler
44#-Q- aix6 # @ job_name   = SE_Checker
45#-Q- aix6 # Fichier de sortie standard du travail
46#-Q- aix6 # @ output     = $(job_name).$(jobid)
47#-Q- aix6 # Fichier de sortie d'erreur du travail
48#-Q- aix6 # @ error      =  $(job_name).$(jobid)
49#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
50#-Q- aix6 # @ notification = error
51#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
52#-Q- aix6 # @ queue
53#-Q- ulam #!/bin/ksh
54#-Q- ulam #######################
55#-Q- ulam ##   ULAM   IDRIS  ##
56#-Q- ulam #######################
57#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
58#-Q- ulam # @ wall_clock_limit = 20:00:00
59#-Q- ulam # Nom du travail LoadLeveler
60#-Q- ulam # @ job_name   = SE_Checker
61#-Q- ulam # Fichier de sortie standard du travail
62#-Q- ulam # @ output     = $(job_name).$(jobid)
63#-Q- ulam # Fichier de sortie d'erreur du travail
64#-Q- ulam # @ error      =  $(job_name).$(jobid)
65#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
66#-Q- ulam # @ notification = error
67#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
68#-Q- ulam # @ queue
69#-Q- sx8mercure #!/bin/ksh
70#-Q- sx8mercure ######################
71#-Q- sx8mercure ## SX8MERCURE   CEA ##
72#-Q- sx8mercure ######################
73#-Q- sx8mercure #PBS -N SE_Checker                   # Nom du job
74#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
75#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
76#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
77#-Q- sx8mercure #PBS -l cputim_job=24:00:00   # Limite temps a 2 heures
78#-Q- sx8mercure #PBS -q scalaire
79#-Q- sx9mercure #!/bin/ksh
80#-Q- sx9mercure #########################
81#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
82#-Q- sx9mercure #########################
83#-Q- sx9mercure #MSUB -r SE_Checker             # Nom du job               
84#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
85#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
86#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
87#-Q- sx9mercure #MSUB -E "-j o"
88#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
89#-Q- titane #!/bin/ksh
90#-Q- titane ######################
91#-Q- titane ## TITANE   CEA ##
92#-Q- titane ######################
93#-Q- titane #MSUB -r SE_Checker             # Nom du job               
94#-Q- titane #MSUB -N 1              # Reservation du noeud
95#-Q- titane #MSUB -n 1              # Reservation du processus
96#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
97#-Q- titane #MSUB -E "-j o"
98#-Q- titane #MSUB -E "-S /bin/ksh"
99#-Q- titane ##MSUB -e nco.out        # Sortie standard
100#-Q- titane ##MSUB -o nco.out        # Sortie standard
101#-Q- lxiv8 ######################
102#-Q- lxiv8 ## OBELIX      LSCE ##
103#-Q- lxiv8 ######################
104#-Q- lxiv8 #PBS -N SE_Checker
105#-Q- lxiv8 #PBS -m a
106#-Q- lxiv8 #PBS -j oe
107#-Q- lxiv8 #PBS -q medium
108#-Q- lxiv8 #PBS -o SE_Checker.$$
109#-Q- lxiv8 #PBS -S /bin/ksh
110#-Q- default #!/bin/ksh
111#-Q- default ##################
112#-Q- default ## DEFAULT HOST ##
113#-Q- default ##################
114
115#**************************************************************
116# Author: Sebastien Denvil
117# Contact: Sebastien.Denvil@ipsl.jussieu.fr
118# $Date$
119# $Author$
120# $Revision$
121# IPSL (2006)
122#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
123# History:
124# Modification:
125#
126#**************************************************************
127
128# Check that everything went well during time series production
129# Display a short report
130# Launch what's missing
131# For use during a run (not on the end : PeriodState=Completed), it will complete
132# all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string.
133
134
135# Chemin vers libIGCM
136libIGCM=${libIGCM:=::modipsl::/libIGCM}
137# Attention : à changer si la machine de post-traitement n'est pas la frontale du serveur de calcul !
138#             voir précence de la variable MirrorlibIGCM dans votre couche systÚme.
139
140# Name Space of this experience
141SpaceName=${SpaceName:=PROD}
142
143# Expericence class of the run
144ExperimentName=${ExperimentName:=historical}
145
146# Name of this job
147JobName=${JobName:=v2.historical1}
148
149# répertoire courrant
150CURRENT_DIR=$( pwd )
151
152# Emplacement des cartes
153CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
154
155# répertoire de stockage des sorties des create_ts
156POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
157
158
159if [ ! -d ${CARD_DIR} ]; then
160    echo "No ${CARD_DIR}, we stop here"
161    exit
162fi
163
164########################################################################
165
166. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
167. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
168. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
169. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
170
171########################################################################
172
173#set -vx
174
175# First of all
176IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
177typeset option
178for option in ${config_UserChoices[*]} ; do
179    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
180done
181
182echo
183IGCM_debug_Print 1 "DefineVariableFromOption  : config_UserChoices"
184IGCM_debug_PrintVariables 3 config_UserChoices_JobName
185#IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
186#IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
187IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
188IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
189IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
190
191DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
192DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
193
194IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
195IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
196
197echo
198IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
199IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
200echo
201
202#====================================================
203#R_SAVE : Job output directory
204if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
205    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
206    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
207    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
208else
209    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
210    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
211fi
212
213IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
214
215IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
216#
217[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
218
219freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
220
221an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
222an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
223an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
224
225#
226while [ ${an_fin} -le ${an_fin_all} ] ; do
227
228    countTotal=0
229    countGood=0
230    countBad=0
231   
232    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
233   
234    for comp in ${config_ListOfComponents[*]} ; do
235        localcountBad=0
236        # Debug Print
237        IGCM_debug_Print 1 ${comp}
238        # Define component
239        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
240        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
241       
242        # Read libIGCM compatibility version in ${compname}.card
243        card=${CARD_DIR}/COMP/${compname}.card
244       
245        # Read and Build Output File stuff
246        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
247        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
248        ListFilesName=${compname}_OutputFiles_List
249        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
250        #
251        if [ X${FileName0} != X${NULL_STR} ] ; then
252            #
253            # INITIALISATION
254            #
255            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
256            typeset i=2
257            #
258            until [ $i -gt $NbFiles ]; do
259                #
260                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
261                #
262                if [ X${flag_post} != XNONE ] ; then
263                    #
264                    # Check if seasonal is required for this file
265                    #
266                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
267                    #
268                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
269                    #
270                    # variable option allready typeset above
271                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
272                        if [ ${option} = Seasonal ] ; then
273                            FoundSeasonal=true
274                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
275                        fi
276                    done
277                    #
278                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
279                        eval ${compname}_${flag_post}_Seasonal=ON
280                    fi
281                    #
282                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
283                        (( i=i+3 ))
284                        continue
285                    fi
286                    #
287                    # CREATE LIST
288                    #
289                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
290                    #
291                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
292                    #
293                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
294                    #
295                    (( countTotal = countTotal + 1 ))
296                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
297                    if [ ! $? = 0 ] ; then
298                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
299                        (( countBad = countBad + 1 ))
300                        (( localcountBad = localcountBad + 1 ))
301                    else
302                        (( countGood = countGood + 1 ))
303                    fi
304                fi
305                (( i=i+3 )) # to explore file list
306            done # until [ $i -eq $NbFiles ]
307        fi   # [ X${FileName0} != X${NULL_STR} ]
308       
309        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
310    done
311   
312    # create_se submit if files don't exist
313    if [ $countGood != $countTotal ] ; then
314        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
315       
316        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
317        export libIGCM=${libIGCM}
318        export SUBMIT_DIR=${SUBMIT_DIR}
319        export POST_DIR=${POST_DIR}
320        export DateBegin=${an_deb}
321        export PeriodDateEnd=${an_fin}1231
322        export RebuildFrequency=${RebuildFrequency}
323        export RESOL_ATM=${RESOL_ATM}
324        export RESOL_SRF=${RESOL_SRF}
325        export RESOL_SBG=${RESOL_SBG}
326        export RESOL_OCE=${RESOL_OCE}
327        export RESOL_ICE=${RESOL_ICE}
328        export RESOL_MBG=${RESOL_MBG}
329        export listVarEnv=${listVarEnv}
330        IGCM_sys_MkdirWork ${POST_DIR}
331        IGCM_debug_Verif_Exit
332        IGCM_sys_QsubPost create_se
333
334        echo
335    fi
336
337    (( an_deb = an_deb + freq ))
338    (( an_fin = an_fin + freq ))
339   
340done # while
341
Note: See TracBrowser for help on using the repository browser.