-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
48 lines (34 loc) · 1.23 KB
/
run.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
#!/usr/bin/env bash
# Run an experiment, run on one of 5 nodes
# required variables:
# - NC: number of clients to run
# - CONCERN: read and write concerns, either "local" or "majority"
# - MAX_XACT: maximum number of transaction to run, this is optional
NC=$1
CONCERN=$2
MAX_XACT=$3
accs=`tail -1 nodes.txt`
acc_arr=($(tail -1 nodes.txt))
# Set n flag
if [ -z "$MAX_XACT" ]; then
nflag=""
else
nflag=" MAX_TRANSACTION=$MAX_XACT"
fi
# Go to home dir
run_id=$NC-$CONCERN
# create log folder
for serverId in $(seq 0 4); do
acc=${acc_arr[serverId]}
ssh $acc "cd; mkdir -p log/${run_id}"
done
ssh ${acc_arr[0]} "source .bash_profile; cd; ~/CS4224-MongoDB/load_data.sh"
for i in $(seq 1 $NC)
do
serverId=$(( $i % 5 ))
ssh ${acc_arr[serverId]} "source .bash_profile; cd; dir=\$(pwd); cd CS4224-MongoDB; PORT=30020 ${nflag} CONCERN=${CONCERN} XACT_FILE=\$dir/data/xact-files/${i}.txt SUMMARY_FILE=\$dir/log/${run_id}-stats.txt npm start > \$dir/log/${run_id}/${i}.log" &
done
wait
echo "Running summary"
ssh ${acc_arr[0]} "source .bash_profile; cd; dir=\$(pwd); cd CS4224-MongoDB; STATS_FILE=\$dir/log/${run_id}-stats.txt npm run summarize > \$dir/log/summary-${run_id}.txt"
echo "Done with NC=${NC} CONCERN=${CONCERN}"