This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
/
run_eval.sh
executable file
·181 lines (151 loc) · 3.1 KB
/
run_eval.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
export TRANSACTIONS_TO_DO=1024
# export TRANSACTIONS_TO_DO=10
export PROCESSES=()
# array of experiment to run:
# format: $client:$gateway:$checkpoint_freq:$test_tps
A=()
# # # exp 3: as function of gateway count
# A+=( \
# 2:2:1:0
# 3:3:1:0
# 4:2:1:0
# 4:4:1:0
# # 2:2:1:1 these seem to have issues
# # 4:2:1:1
# # 3:3:1:1
# # 4:4:1:1
# )
# A+=( \
# # cp 1
# 2:1:1:0
# 3:1:1:0
# 4:1:1:0
# 5:1:1:0
# 6:1:1:0
# 7:1:1:0
# 8:1:1:0
# 9:1:1:0
# # cp 4
# 2:1:4:0
# 3:1:4:0
# 4:1:4:0
# 5:1:4:0
# 6:1:4:0
# 7:1:4:0
# 8:1:4:0
# 9:1:4:0
# )
# # no delay
# A+=( \
# # cp 1
# 2:1:1:1
# 3:1:1:1
# 4:1:1:1
# 5:1:1:1
# 6:1:1:1
# 7:1:1:1
# 8:1:1:1
# 9:1:1:1
# # cp 4
# 2:1:4:1
# 3:1:4:1
# 4:1:4:1
# 5:1:4:1
# 6:1:4:1
# 7:1:4:1
# 8:1:4:1
# 9:1:4:1
# )
# exp 2: as function of checkpoint_freq
# A+=(7:1:2:0)
# A+=(7:1:2:1)
# for f in $(seq 6 2 32); do # checkpoint_freq 10-32 (2-8 are already in test 1)
# A+=(7:1:$f:0)
# # A+=(7:1:$f:1)
# done
A+=(
7:1:32:0
)
# could to better:
# A+=(
# 5:1:4:1
# 4:1:1:1
# 5:1:1:1
# 6:1:1:1
# 7:1:1:1
# 8:1:1:1
# )
# # exp 1: as function of users
# for f in 1 $(seq 2 2 8); do # checkpoint_freq 1 2 4 6 8
# for c in $(seq 2 7); do # n_clients 2 - 7 (1 gateway 7 clients is max because 8 cores)
# A+=($c:1:$f:0)
# A+=($c:1:$f:1)
# done
# done
# simple test
# A=( 2:1:2 )
# echo ${A[@]} | tr " " "\n"
# exit
function run_docker {
docker system prune -f
docker volume rm gateway_sync
docker network prune -y
rm backend/eval/keys/* || true
docker-compose -f docker-compose-eval.yml up --scale gateway=$GATEWAYS --scale client=$CLIENTS --build | tee eval_data/$a.log
rm backend/eval/keys/* || true
}
function clean_up {
# Perform program exit housekeeping
echo KILLING
kill -9 $PROCESSES
exit
}
trap clean_up SIGHUP SIGINT SIGTERM
function run_local {
(rm eval/keys/* || true) > /dev/null 2>&1
(rm eval/sync/* || true) > /dev/null 2>&1
(rm eval/database/* || true) > /dev/null 2>&1
export PORT=8090
export BASE_DIR=eval
export IS_GATEWAY=1
for i in $(seq 1 $GATEWAYS)
do
echo STARTNG GATEWAY $PORT
pipenv run python stablecoin/run_eval.py &
PROCESSES+=($!)
((PORT=PORT+1))
done
IS_GATEWAY=0
for i in $(seq 1 $CLIENTS)
do
echo STARTNG CLIENT $PORT
pipenv run python stablecoin/run_eval.py &
PROCESSES+=($!)
((PORT=PORT+1))
done
wait $PROCESSES
PROCESSES=()
sleep 1
return
}
# cd ./backend
for a in ${A[@]}
do
export CLIENTS=${a%:*:*:*}
tmp=${a#"$CLIENTS"}
tmp=${tmp#:}
export GATEWAYS=${tmp%:*:*}
tmp=${tmp#"$GATEWAYS"}
tmp=${tmp#:}
export CHECKPOINT_EVERY=${tmp%:*}
tmp=${tmp#"$CHECKPOINT_EVERY"}
export TPS_TEST=${tmp#:}
# echo $CLIENTS
# echo $GATEWAYS
# echo $CHECKPOINT_EVERY
# echo $TPS_TEST
# echo -----
run_docker
# run_local
done