This repository has been archived by the owner on May 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
tutorial.sh
executable file
·164 lines (133 loc) · 3.28 KB
/
tutorial.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
set -e -u
PROJECT="triage-dirtyduck"
PROJECT_HOME="$( cd "$( dirname "$0" )" && pwd )"
INFRASTRUCTURE_HOME="${PROJECT_HOME}/infrastructure"
cd "$INFRASTRUCTURE_HOME"
function help_menu () {
cat << EOF
Usage: ${0} {start|stop|build|rebuild|run|logs|status|destroy|all|}
OPTIONS:
-h|help Show this message
start
stop
rebuild
status
destroy
-t|triage
-a|all
INFRASTRUCTURE:
Build the infrastructure:
$ ./tutorial.sh start
Check the status of the containers:
$ ./tutorial.sh status
Stop the tutorial's infrastructure:
$ ./tutorial.sh stop
Destroy all the resources related to the tutorial:
$ ./tutorial.sh destroy
View the infrastructure logs:
$ ./tutorial.sh -l
EXPERIMENTS:
NOTE:
The following commands assume that "sample_experiments.yaml"
is located inside the triage/experiments directory
Run one experiment:
$ ./tutorial.sh -t --config_file sample_experiment_config.yaml run
Run one experiment, do not replace existing matrices or models, and enable debug:
$ ./tutorial.sh -t --config_file sample_experiment_config.yaml --no-replace --debug run
Validate experiment configuration file:
$ ./tutorial.sh triage --config_file sample_experiment_config.yaml validate
Show the experiment's temporal cross-validation blocks:
$ ./tutorial.sh -t --config_file sample_experiment_config.yaml show-temporal-blocks
Plot model number 4 (for Decision Trees and Random Forests):
$ ./tutorial.sh -t --config_file sample_experiment_config.yaml show_model_plot --model 4
Triage help:
$ ./tutorial.sh triage --help
EOF
}
function start_infrastructure () {
docker-compose --project-name ${PROJECT} up -d food_db
#tyra reverseproxy api
}
function stop_infrastructure () {
docker-compose --project-name ${PROJECT} stop
}
function build_images () {
docker-compose --project-name ${PROJECT} build "${@}"
}
function destroy () {
docker-compose --project-name ${PROJECT} down --rmi all --remove-orphans --volumes
}
function infrastructure_logs () {
docker-compose --project-name ${PROJECT} logs -f -t
}
function status () {
docker-compose --project-name ${PROJECT} ps
}
function bastion () {
docker-compose --project-name ${PROJECT} run --service-ports --rm --name tutorial_bastion bastion
}
function triage () {
docker-compose --project-name ${PROJECT} run --rm --name triage_experiment triage "${@}"
}
function all () {
build_images
start_infrastructure
status
}
if [[ $# -eq 0 ]] ; then
help_menu
exit 0
fi
case "$1" in
start)
start_infrastructure
shift
;;
stop)
stop_infrastructure
shift
;;
build)
build_images
shift
;;
rebuild)
build_images --no-cache
shift
;;
-d|destroy)
destroy
shift
;;
-l|logs)
infrastructure_logs
shift
;;
status)
status
shift
;;
-t|triage)
triage ${@:2}
shift
;;
bastion)
bastion
shift
;;
-a|--all)
all
shift
;;
-h|--help)
help_menu
shift
;;
*)
echo "${1} is not a valid flag, try running: ${0} --help"
shift
;;
esac
shift
cd - > /dev/null