forked from cockroachlabs/cloud-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tpcc_experiment.sh
executable file
·138 lines (115 loc) · 3.02 KB
/
run_tpcc_experiment.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
#!/bin/bash
curdate=$(date '+%Y%m%d')
cloud=
args=
function usage() {
echo "$1
Usage: $0 -d date
-d date: date of the folder of the script.
-c cloud: the script from a specific cloud.
-a args: arguments for each test script. (e.g. \"-b all -w net -d\")
-n: dry run; echo all runs but do not execute them.
"
exit 1
}
while getopts 'a:d:c:n' flag; do
case "${flag}" in
n) dry_run="y" ;;
d) curdate="${OPTARG}" ;;
c) cloud="${OPTARG}" ;;
a) args="${OPTARG}" ;;
*) usage "";;
esac
done
echo curdate=$curdate
# The rest of the arguments may contain paths to the scripts to execute.
# If not specified, attempts to find scripts in the cloud directory.
shift $((OPTIND - 1 ))
scriptPaths=("$@")
if [[ ${#scriptPaths[@]} == 0 ]]
then
case "${cloud}" in
aws)
scriptPaths=($(find ./report-data/$curdate/aws -name "*.sh" | tr '\n' ' '))
;;
gce)
scriptPaths=($(find ./report-data/$curdate/gce -name "*.sh" | tr '\n' ' '))
;;
azure)
scriptPaths=($(find ./report-data/$curdate/azure -name "*.sh" | tr '\n' ' '))
;;
*)
echo "unsupported cloud name"
exit 1
esac
fi
num_runs_per_vcpu=4
function prompt() {
num_runs_per_vcpu=4
if [ -n "$yes_all" ]
then
return 0
fi
echo -n "$@ [y|Y|#|n]? "
local answer=''
read answer
case "${answer}" in
y) return 0 ;;
Y) yes_all='y'
return 0
;;
1|2|3|4|5)
num_runs_per_vcpu=$answer
return 0
;;
*) return 1 ;;
esac
}
for scriptPath in "${scriptPaths[@]}"
do
if ! prompt "Execute '$scriptPath'"
then
echo "Skipping ..."
continue
fi
session_name="${cloud}_`basename $scriptPath .sh`"
set +e
tmux new -s $session_name -d
set -e
if [[ $scriptPath =~ 32|30|8xl|9x ]]
then
warehousePerVcpuList=( 50 75 100 125 150 1200 )
else
warehousePerVcpuList=( 50 75 100 125 150 )
fi
for warehousePerVcpu in "${warehousePerVcpuList[@]}"
do
if ! prompt "Execute '$scriptPath' vcpu=$warehousePerVcpu"
then
echo "Skipping ..."
continue
fi
for (( run=1; run<=$num_runs_per_vcpu; run++ ))
do
diskname="$(basename $(dirname $(dirname "$scriptPath") ))"
filename=$(basename $scriptPath)
if (( warehousePerVcpu < 1000 ))
then
extra_arg="-a $warehousePerVcpu"
else
extra_arg="-A $warehousePerVcpu"
fi
name_extra="$warehousePerVcpu-$run"
echo "tmux neww -t $session_name -n $diskname-$filename-$name_extra -d -- \"CRL_USERNAME=$USER NAME_EXTRA=$name_extra TPCC_EXTRA_ARGS='$extra_arg' $scriptPath -b all -w tpcc -c ./cockroach-linux-2.6.32-gnu-amd64 -d\""
if [ -z "$dry_run" ]
then
tmux neww -t $session_name -n $diskname-$filename-$name_extra -d -- "CRL_USERNAME=$USER NAME_EXTRA=$name_extra TPCC_EXTRA_ARGS='$extra_arg' $scriptPath -b all -w tpcc -c ./cockroach-linux-2.6.32-gnu-amd64 -d"
echo "Sleeping for 30s"
sleep 30
fi
done
done
#echo "Sleeping for 10 minutes"
#echo sleep 600
echo "------"
done