source: trunk/libIGCM/AA_RunChecker @ 1137

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