source: branches/libIGCM_CESMEP/AA_RunChecker

Last change on this file was 1525, checked in by cetlod, 4 years ago

Update Scripts for Post-processing on Irene-Rome

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Revision Author Date
File size: 7.2 KB
Line 
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)
25TaskType=checking
26typeset -i Verbosity=0
27
28CurrentUsr=$( whoami )
29
30if ( [ $# -eq 0 ] ) ; then
31  $0 -h
32  exit
33fi
34
35# Arguments
36# =========
37# Default argument values
38# -----------------------
39TargetUsr=${CurrentUsr}
40HostName=$( hostname | sed -e "s/[0-9].*//" )
41
42fg_color=true
43fg_search=false
44fg_quiet=false
45fg_running=false
46fg_path=false
47NbHisto=20
48
49# Get arguments from command line
50# -------------------------------
51while 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
97done
98shift $(($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.
102if ( ( ! ${fg_path} ) && ( ! ${fg_running} ) && [ $# -lt 1 ] ) ; then
103  $0 -h
104  exit
105fi
106
107if ( ( ${fg_path} ) && ( ${fg_search} ) ) ; then
108  echo "You cannot use -s and -p at the same time"
109  exit
110fi
111
112if ( ( ${fg_path} ) && ( ${fg_running} ) ) ; then
113  echo "You cannot use -r and -p at the same time"
114  exit
115fi
116
117
118# Load libIGCM library
119# ====================
120libIGCM=${libIGCM:=::modipsl::/libIGCM}
121
122DEBUG_debug=false
123DEBUG_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
138if ( ${fg_running} ) ; then
139  # Look for running simu
140  IGCM_sys_ListJobInQueue ${TargetUsr} JobNameList
141fi
142
143if [ $# -ge 1 ] ; then
144  set -A JobNameList ${JobNameList[*]} ${*}
145elif ( ${fg_path} ) ; then
146  set -A JobNameList "Unknown"
147fi
148
149if [ ${#JobNameList[*]} -lt 1 ] ; then
150  echo "No running simulation found."
151  exit 0
152fi
153
154
155if ( ${fg_quiet} ) ; then
156  NbHisto=1
157fi
158
159# Define the catalog in which the known simulations are stored
160# ============================================================
161SimuCatalog="${HOME}/.simucatalog.dat"
162if [ ! -s ${SimuCatalog} ] ; then
163  touch ${SimuCatalog}
164fi
165
166
167for 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
281done
Note: See TracBrowser for help on using the repository browser.