-
Notifications
You must be signed in to change notification settings - Fork 0
/
constraint-tools
executable file
·41 lines (34 loc) · 1.29 KB
/
constraint-tools
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
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o noclobber
set -o nounset
# set -o xtrace
# Must use single quote to prevent variable expansion.
# For example, if double quotes were used, ${LINENO} would take on the value of the current line,
# instead of its value when PS4 is used later in the script
# https://stackoverflow.com/a/6697845/6674256
# ${FOO:+val} val if $FOO is set
# ${FOO[0]} element #0 of the FOO array
# https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
PS4='+ (${BASH_SOURCE[0]##*/} @ ${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
export RED='\033[0;31m'
export CYAN='\033[0;36m'
export NO_COLOR='\033[0m'
# https://stackoverflow.com/a/246128/6674256
root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# https://stackoverflow.com/a/43476575/6674256
export PYTHONPATH="${root}/utilities:${root}/predict-constraint"
tool="${1}"
bash ${root}/utilities/info.sh "\nTool: ${tool}\n"
shift
args="${@}"
bash ${root}/utilities/info.sh "Tool arguments: ${args}\n"
if [[ ${tool} == "train" ]]; then
bash ${root}/train-model/train-model.sh ${args} --root ${root}
elif [[ ${tool} == "visualize" ]]; then
bash ${root}/flask-app/app.sh ${args} --root ${root}
else
bash ${root}/utilities/error.sh "invalid tool: ${tool}"
exit 1
fi