source: trunk/libIGCM/AA_RunChecker @ 1456

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