source: flex_extract.git/Run/run.sh @ 3a54479

ctbtodev
Last change on this file since 3a54479 was 3a54479, checked in by Anne Philipp <anne.philipp@…>, 4 years ago

added automatic python3 loading on ECMWF servers in setup and run scripts

  • Property mode set to 100755
File size: 2.9 KB
RevLine 
[2fb99de]1#!/bin/bash
[ca867de]2#
3# @Author: Anne Philipp
4#
5# @Date: October, 4 2018
6#
7# @Description:
[afbd3a1]8#    This script defines the available command-line parameters
9#    for running flex_extract and combines them for the execution 
10#    of the Python program. It also does some checks to
11#    guarantee necessary parameters were set and consistent.
12#
13# @Licence:
14#    (C) Copyright 2014-2019.
15#
16#    SPDX-License-Identifier: CC-BY-4.0
17#
18#    This work is licensed under the Creative Commons Attribution 4.0
19#    International License. To view a copy of this license, visit
20#    http://creativecommons.org/licenses/by/4.0/ or send a letter to
21#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
[ca867de]22#
23# -----------------------------------------------------------------
24# AVAILABLE COMMANDLINE ARGUMENTS TO SET
[433d1eb]25#
[b02a07e]26# THE USER HAS TO SPECIFY THESE PARAMETERS:
[ca867de]27
[34b247b]28QUEUE='ecgate'
[d78851d]29START_DATE=None
30END_DATE=None
[ca867de]31DATE_CHUNK=None
[433d1eb]32JOB_CHUNK=3
[ca867de]33BASETIME=None
34STEP=None
35LEVELIST=None
36AREA=None
[433d1eb]37INPUTDIR=None
[ca867de]38OUTPUTDIR=None
39PP_ID=None
[a916e8f]40JOB_TEMPLATE='submitscript.template' 
[d78851d]41CONTROLFILE='CONTROL_EA5' 
42DEBUG=0
[d2b7217]43REQUEST=2
[0e576fc]44PUBLIC=0
[ca867de]45
46# -----------------------------------------------------------------
47#
48# AFTER THIS LINE THE USER DOES NOT HAVE TO CHANGE ANYTHING !!!
49#
50# -----------------------------------------------------------------
51
52# PATH TO SUBMISSION SCRIPT
[ba99230]53pyscript=../Source/Python/submit.py
[ca867de]54
55# INITIALIZE EMPTY PARAMETERLIST
56parameterlist=""
57
[3a54479]58# CHECK IF ON ECMWF SERVER;
59if [[ $HOST == *"ecgb"* ]] || [[ $HOST == *"cca"* ]] || [[ $HOST == *"ccb"* ]]; then
60# LOAD PYTHON3 MODULE
61  module load python3
62fi 
63
[ca867de]64# CHECK FOR MORE PARAMETER
65if [ -n "$START_DATE" ]; then
66  parameterlist+=" --start_date=$START_DATE"
67fi
68if [ -n "$END_DATE" ]; then
69  parameterlist+=" --end_date=$END_DATE"
70fi
71if [ -n "$DATE_CHUNK" ]; then
72  parameterlist+=" --date_chunk=$DATE_CHUNK"
73fi
[b02a07e]74if [ -n "$JOB_CHUNK" ]; then
75  parameterlist+=" --job_chunk=$JOB_CHUNK"
76fi
[ca867de]77if [ -n "$BASETIME" ]; then
78  parameterlist+=" --basetime=$BASETIME"
79fi
80if [ -n "$STEP" ]; then
81  parameterlist+=" --step=$STEP"
82fi
83if [ -n "$LEVELIST" ]; then
84  parameterlist+=" --levelist=$LEVELIST"
85fi
86if [ -n "$AREA" ]; then
87  parameterlist+=" --area=$AREA"
88fi
89if [ -n "$INPUTDIR" ]; then
90  parameterlist+=" --inputdir=$INPUTDIR"
91fi
92if [ -n "$OUTPUTDIR" ]; then
93  parameterlist+=" --outputdir=$OUTPUTDIR"
94fi
95if [ -n "$PP_ID" ]; then
96  parameterlist+=" --ppid=$PP_ID"
97fi
98if [ -n "$JOB_TEMPLATE" ]; then
99  parameterlist+=" --job_template=$JOB_TEMPLATE"
100fi
101if [ -n "$QUEUE" ]; then
102  parameterlist+=" --queue=$QUEUE"
103fi
104if [ -n "$CONTROLFILE" ]; then
105  parameterlist+=" --controlfile=$CONTROLFILE"
106fi
107if [ -n "$DEBUG" ]; then
108  parameterlist+=" --debug=$DEBUG"
109fi
110if [ -n "$REQUEST" ]; then
111  parameterlist+=" --request=$REQUEST"
112fi
[5bad6ec]113if [ -n "$PUBLIC" ]; then
114  parameterlist+=" --public=$PUBLIC"
115fi
[ca867de]116
117# -----------------------------------------------------------------
[b02a07e]118# CALL SCRIPT WITH DETERMINED COMMANDLINE ARGUMENTS
[ca867de]119
120$pyscript $parameterlist
[2fb99de]121
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG