-
Notifications
You must be signed in to change notification settings - Fork 4
/
make_ecflow_files_for.sh
executable file
·73 lines (58 loc) · 1.69 KB
/
make_ecflow_files_for.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /bin/bash
set -ue
# Get the directory in which this script resides. We'll assume the
# yaml files are there:
dir0=$( dirname "$0" )
here=$( cd "$dir0" ; pwd -P )
utils=$here/utils
#if [[ ! -s .in-the-ecfutils-dir ]] ; then
# echo "This script must be within the ecf/ecfutils directory when running it." 1>&2
# exit 2
#fi
export WORKTOOLS_VERBOSE=NO
yamldir=$( cd ../ ; pwd -P )
# Make sure this directory is in the python path so we find worktools.py:
export PYTHONPATH=$here:$utils:$yamldir:${PYTHONPATH:+:$PYTHONPATH}
source "$dir0/utils/worktools.sh.inc"
# Parse arguments:
if [[ "$1" == "-v" ]] ; then
export WORKTOOLS_VERBOSE=YES
shift 1
fi
export EXPDIR="$1"
export FIRST_CYCLE="${2:-}"
export LAST_CYCLE="${3:-}"
#if [[ ! -d /usrx/local ]] ; then
# echo "ERROR: This script only runs on WCOSS" 1>&2
# exit 1
#fi
#check_ecf_variables
if [[ "${WORKTOOLS_VERBOSE:-NO}" == YES ]] ; then
echo "make_ecflow_files_for.sh: verbose mode"
fi
echo 'ecFlow server settings:'
echo " port: $ECF_PORT"
echo " root: $ECF_ROOT"
echo " home: $ECF_HOME"
echo " host: $ECF_HOST"
set +e
find_python36
set -e
if [[ "${WORKTOOLS_VERBOSE:-NO}" == YES ]] ; then
echo "make_ecflow_files_for.sh: EXPDIR=$EXPDIR"
set -x
fi
# Profiling version:
# $python36 -c "import worktools, cProfile ; cmd='''worktools.make_ecflow_files_for_cycles(
# '$EXPDIR',
# '$FIRST_CYCLE',
# '$LAST_CYCLE')''' ; cProfile.run(cmd) "
if [[ $FIRST_CYCLE == '' ]] ; then
echo "no dates"
$python36 -c "import worktools ; worktools.make_ecflow_files_for_cycles('$EXPDIR') "
else
$python36 -c "import worktools ; worktools.make_ecflow_files_for_cycles(
'$EXPDIR',
'$FIRST_CYCLE',
'$LAST_CYCLE') "
fi