forked from socialsensor/graphdb-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 13
/
run.sh
158 lines (148 loc) · 5.05 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
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
#!/bin/bash
CQLSH=/home/cassandra/cassandra/bin/cqlsh
CASSANDRA_HOST=127.0.0.1
CASSANDRA_PORT=8042
DROP='DROP KEYSPACE IF EXISTS titan;'
CASSANDRA_CONNECT_TIMEOUT=30
CASSANDRA_REQUEST_TIMEOUT=60
ROOT_DIR=.
CONF_FILE=$ROOT_DIR/src/test/resources/META-INF/input.properties
dataset() {
if [ $1 -eq 1 ]; then
data="email-Enron.txt"
elif [ $1 -eq 2 ]; then
data="amazon0601.txt"
elif [ $1 -eq 3 ]; then
data="com-youtube.ungraph.txt"
elif [ $1 -eq 4 ]; then
data="com-lj.ungraph.txt"
elif [ $1 -eq 5 ]; then
data="network1000.dat"
elif [ $1 -eq 6 ]; then
data="network5000.dat"
elif [ $1 -eq 7 ]; then
data="network10000.dat"
elif [ $1 -eq 8 ]; then
data="network20000.dat"
elif [ $1 -eq 9 ]; then
data="network30000.dat"
elif [ $1 -eq 10 ]; then
data="network40000.dat"
elif [ $1 -eq 11 ]; then
data="network50000.dat"
else
echo "Wrong test number: $i, must be 1,2,3...11"
exit 1
fi
prefix=`echo $data | awk -F'.' '{print $1}'`
}
community() {
if [ $1 -eq 5 ]; then
community="community1000.dat"
elif [ $1 -eq 6 ]; then
community="community5000.dat"
elif [ $1 -eq 7 ]; then
community="community10000.dat"
elif [ $1 -eq 8 ]; then
community="community20000.dat"
elif [ $1 -eq 9 ]; then
community="community30000.dat"
elif [ $1 -eq 10 ]; then
community="community40000.dat"
elif [ $1 -eq 11 ]; then
community="community50000.dat"
else
echo "Wrong test number: $i, must be 5,6,7...11"
exit 1
fi
}
run() {
# modify configuration
sed -i "s/eu.socialsensor.results-path=results/eu.socialsensor.results-path=results\/$prefix/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.benchmarks=MASSIVE_INSERTION/eu.socialsensor.benchmarks=MASSIVE_INSERTION/g" $CONF_FILE
if [ $1 -lt 5 ]; then
sed -i "s/^#eu.socialsensor.dataset=data\/$data/eu.socialsensor.dataset=data\/$data/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.benchmarks=FIND_NEIGHBOURS/eu.socialsensor.benchmarks=FIND_NEIGHBOURS/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.benchmarks=FIND_ADJACENT_NODES/eu.socialsensor.benchmarks=FIND_ADJACENT_NODES/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.benchmarks=FIND_SHORTEST_PATH/eu.socialsensor.benchmarks=FIND_SHORTEST_PATH/g" $CONF_FILE
else
community $1
sed -i "s/^#eu.socialsensor.dataset=data\/network1000.dat/eu.socialsensor.dataset=data\/$data/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.actual-communities=data\/community1000.dat/eu.socialsensor.actual-communities=data\/$community/g" $CONF_FILE
sed -i "s/^#eu.socialsensor.benchmarks=CLUSTERING/eu.socialsensor.benchmarks=CLUSTERING/g" $CONF_FILE
fi
# clear data of neo4j and hugegraphcore
if [ -d $ROOT_DIR/storage ]; then
rm -fr $ROOT_DIR/storage
fi
# clear data of titan in cassandra
$CQLSH $CASSANDRA_HOST $CASSANDRA_PORT -e "$DROP" --connect-timeout=$CASSANDRA_CONNECT_TIMEOUT --request-timeout=$CASSANDRA_REQUEST_TIMEOUT
# clear results
if [ -d $ROOT_DIR/results/$prefix ]; then
rm -fr $ROOT_DIR/results/$prefix
fi
# test
mvn test > logs/$prefix.log 2>&1
if [ $? -eq 0 ]; then
echo "$prefix executed successfully!"
else
echo "$prefix executed failed!"
fi
# restore configuration
sed -i "s/^eu.socialsensor.dataset=data\/$data/#eu.socialsensor.dataset=data\/$data/g" $CONF_FILE
sed -i "s/^eu.socialsensor.results-path=results\/$prefix/eu.socialsensor.results-path=results/g" $CONF_FILE
}
run_test() {
# backup configuration file
cp $CONF_FILE $CONF_FILE.bak
sed -i "s/^eu.socialsensor.dataset/#eu.socialsensor.dataset/g" $CONF_FILE
sed -i "s/^eu.socialsensor.benchmarks/#eu.socialsensor.benchmarks/g" $CONF_FILE
dataset $1
echo "Starting run test: $data"
run $1
# resume configuration file
rm -f $CONF_FILE
mv $CONF_FILE.bak $CONF_FILE
}
if [ $# -eq 0 -o "$1" = "-h" ]; then
echo "Usage: ./run.sh test-number"
echo "For example:"
echo " ./run.sh 1"
echo " ./run.sh 1 2 3"
echo " ./run.sh all"
echo ""
echo "test-number represent different tests:"
echo "1 email-enron"
echo "2 amazon"
echo "3 youtube"
echo "4 com-lj"
echo "5 network1000"
echo "6 network5000"
echo "7 network10000"
echo "8 network20000"
echo "9 network30000"
echo "10 network40000"
echo "11 network50000"
echo "all represent all test_number that can pass currently"
echo ""
echo "Currently tests with test-number [1,2,3,4,5,6,7,8] can pass"
echo "Tests [9,10,11,12] will cost more than 3 hours when using titan"
exit 1
fi
if [ ! -d $ROOT_DIR/metrics ]; then
mkdir $ROOT_DIR/metrics
fi
if [ $# -eq 1 -a "$1" = "all" ]; then
tests="1 2 3 4 5 6 7 8"
echo "Starting run all tests..."
for i in $tests;
do
echo $i
run_test $i
done
else
for i in $@;
do
run_test $i
done
fi