-
Notifications
You must be signed in to change notification settings - Fork 38
/
heron
executable file
·63 lines (56 loc) · 1.42 KB
/
heron
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
#!/bin/bash
echo "Starting HERON ..."
# identify HERON location
SCRIPT_NAME=$(readlink $0)
if test -x "$SCRIPT_NAME";
then
HERON_DIRNAME=$(dirname $SCRIPT_NAME)
else
HERON_DIRNAME=$(dirname $0)
fi
HERON_DIR=$(cd $HERON_DIRNAME; pwd)
if command -v python; then
#python exists
WORKING_PYTHON_COMMAND=python
elif command -v python3; then
#python3 exists
WORKING_PYTHON_COMMAND=python3
else
echo ERROR Neither python nor python3 are available
fi
# identify RAVEN location
RAVEN_DIR=$($WORKING_PYTHON_COMMAND $HERON_DIRNAME/src/_utils.py get_raven_loc)
echo " ... RAVEN located at \"${RAVEN_DIR}\""
# activate conda environment
echo " ... Activating CONDA environment ..."
source $RAVEN_DIR/scripts/establish_conda_env.sh --quiet
# set up run keywords
# "ARGS" stores command line arguments not treated in this file (passed through)
declare -a ARGS
while test $# -gt 0
do
case "$1" in
--python-command=*)
PYTHON_COMMAND="${1#*=}"
;;
*)
# otherwise, pass through arguments to main.py
ARGS[${#ARGS[@]}]="$1"
;;
esac
shift
done
# establish python command
PYTHON_COMMAND=${PYTHON_COMMAND:=python}
# call heron using python
echo 'Running HERON ...'
$PYTHON_COMMAND $HERON_DIR/src/main.py "${ARGS[@]}"
SUCCESS=$?
# check exit status
if [[ $SUCCESS == 0 ]];
then
echo ' ... HERON completed successfully.'
else
echo ' ... Errors were encountered while running HERON.'
fi
exit $SUCCESS