source: trunk/libIGCM/AA_RunChecker @ 1525

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