source: trunk/libIGCM/AA_RunChecker @ 1412

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