source: trunk/libIGCM/AA_RunChecker @ 1517

Last change on this file since 1517 was 1437, checked in by jgipsl, 6 years ago

For Irene:

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