source: flex_extract.git/Documentation/html/_sources/Documentation/Input/jobscript.rst.txt @ 47be2684

ctbtodev
Last change on this file since 47be2684 was 6931f61, checked in by anphi <anne.philipp@…>, 4 years ago

Update Onlinedocumentation after review of language editing

  • Property mode set to 100644
File size: 5.4 KB
Line 
1**************************
2The job script ``job.ksh``
3**************************
4
5The job script is a Korn-shell script which will be created at runtime for each ``flex_extract`` execution in the application modes **remote** and **gateway**.
6
7It is based on the ``submitscript.template`` template file stored in the ``Templates`` directory.
8This template is generated in the installation process from a ``jobscript.template`` template file.
9
10``Flex_extract`` uses the Python package `genshi <https://genshi.edgewall.org/>`_ to generate
11the Korn-shell script from the template files by substituting the individual parameters.
12These individual parameters are marked by ``$$`` in ``jobscript.template``.
13
14The job script has a number of settings for the batch system which are fixed, and differentiates between the *ecgate* and the *cca/ccb*
15server system to load the necessary modules for the environment when submitted to the batch queue.
16
17The submission is done by the ``ECaccess`` tool from within ``flex_extract`` with the command ``ecaccess-job-submit``.
18
19
20
21What does the job script do?
22----------------------------
23
24 #. It sets necessary batch system parameters.
25 #. It prepares the job environment at the ECMWF servers by loading the necessary library modules.
26 #. It sets some environment variables for the single session.
27 #. It creates the directory structure in the user's ``$SCRATCH`` file system.
28 #. It creates a CONTROL file on the ECMWF servers whith the parameters set before creating the ``job.ksh``. ``Flex_extract`` has a set of parameters which are passed to the job script with their default or the user-defined values. It also sets ``CONTROL`` as an environment variable.
29 #. ``Flex_extract`` is started from within the ``work`` directory of the new directory structure by calling the ``submit.py`` script. It sets new paths for input and output directories and the recently generated ``CONTROL`` file.
30 #. At the end, it checks whether the script has returned an error or not, and emails the log file to the user.
31
32
33
34
35Example ``job.ksh``
36-------------------------
37 
38.. code-block::  bash
39
40    #!/bin/ksh
41
42    # ON ECGB:
43    # start with ecaccess-job-submit -queueName ecgb NAME_OF_THIS_FILE  on gateway server
44    # start with sbatch NAME_OF_THIS_FILE directly on machine
45
46    #SBATCH --workdir=/scratch/ms/at/km4a
47    #SBATCH --qos=normal
48    #SBATCH --job-name=flex_ecmwf
49    #SBATCH --output=flex_ecmwf.%j.out
50    #SBATCH --error=flex_ecmwf.%j.out
51    #SBATCH --mail-type=FAIL
52    #SBATCH --time=12:00:00
53
54    ## CRAY specific batch requests
55    ##PBS -N flex_ecmwf
56    ##PBS -q np
57    ##PBS -S /usr/bin/ksh
58    ## -o /scratch/ms/at/km4a/flex_ecmwf.${PBS_JOBID}.out
59    ## job output is in .ecaccess_DO_NOT_REMOVE
60    ##PBS -j oe
61    ##PBS -V
62    ##PBS -l EC_threads_per_task=24
63    ##PBS -l EC_memory_per_task=32000MB
64
65    set -x
66    export VERSION=7.1
67    case ${HOST} in
68      *ecg*)
69      module unload grib_api
70      module unload emos
71      module load python3
72      module load eccodes
73      module load emos/455-r64
74      export PATH=${PATH}:${HOME}/flex_extract_v7.1/Source/Python
75      ;;
76      *cca*)
77      module switch PrgEnv-cray PrgEnv-intel
78      module load python3
79      module load eccodes
80      module load emos/455-r64
81      export SCRATCH=${TMPDIR}
82      export PATH=${PATH}:${HOME}/flex_extract_v7.1/Source/Python
83      ;;
84    esac
85
86    cd ${SCRATCH}
87    mkdir -p python$$
88    cd python$$
89
90    export CONTROL=CONTROL
91
92    cat >${CONTROL}<<EOF
93    accmaxstep 24
94    acctime 18
95    acctype FC
96    accuracy 24
97    addpar None
98    area 74.0/-24.0/10.0/60.0
99    basetime None
100    cds_api None
101    controlfile CONTROL_CERA
102    cwc 1
103    dataset None
104    date_chunk 3
105    debug 1
106    destination <specificname>@genericSftp
107    doubleelda 0
108    dpdeta 1
109    dtime 3
110    ec_api None
111    ecfsdir ectmp:/${USER}/econdemand/
112    ecgid at
113    ecstorage 0
114    ectrans 1
115    ecuid km4a
116    end_date 20000809
117    eta 1
118    etadiff 0
119    etapar 77
120    expver 1
121    format GRIB1
122    gateway srvx8.img.univie.ac.at
123    gauss 0
124    gaussian
125    grib2flexpart 0
126    grid 1.0/1.0
127    inputdir <path-to-flex_extract>/flex_extract_v7.1/run/workspace
128    install_target None
129    job_chunk 1
130    job_template job.temp
131    left -24.
132    level 91
133    levelist 1/to/91
134    logicals gauss omega omegadiff eta etadiff dpdeta cwc wrf grib2flexpart ecstorage ectrans debug oper request public purefc rrint doubleelda
135    lower 10.
136    mailfail ${USER}
137    mailops ${USER}
138    marsclass EP
139    maxstep 0
140    number 000
141    omega 0
142    omegadiff 0
143    oper 0
144    outputdir <path-to-flex_extract>/flex_extract_v7.1/run/workspace
145    prefix CE
146    public 0
147    purefc 0
148    queue ecgate
149    request 2
150    resol 159
151    right 60.
152    rrint 0
153    smooth 0
154    start_date 20000809
155    step 00 00 00 00 00 00 00 00
156    stream ENDA
157    time 00 03 06 09 12 15 18 21
158    type AN AN AN AN AN AN AN AN
159    upper 74.
160    wrf 0
161
162    EOF
163
164
165    submit.py --controlfile=${CONTROL} --inputdir=./work --outputdir=./work 1> prot 2>&1
166
167    if [ $? -eq 0 ] ; then
168      l=0
169      for muser in `grep -i MAILOPS ${CONTROL}`; do
170          if [ ${l} -gt 0 ] ; then
171             mail -s flex.${HOST}.$$ ${muser} <prot
172          fi
173          l=$((${l}+1))
174      done
175    else
176      l=0
177      for muser in `grep -i MAILFAIL ${CONTROL}`; do
178          if [ ${l} -gt 0 ] ; then
179             mail -s "ERROR! flex.${HOST}.$$" ${muser} <prot
180          fi
181          l=$((${l}+1))
182      done
183    fi
184
185
186   
187
188.. toctree::
189    :hidden:
190    :maxdepth: 2
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG