-
Notifications
You must be signed in to change notification settings - Fork 1
/
mbclient.py
executable file
·55 lines (46 loc) · 2.04 KB
/
mbclient.py
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
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from threaded_ssh import ThreadedClients
from ServerConfig import Storage
from ServerConfig import TellStore
from ServerConfig import Kudu
from ServerConfig import Cassandra
from ServerConfig import Microbench
def startMBClient(populate = False, uoutFile = None):
default_out = ""
if Storage.storage == TellStore:
default_out = "mbench_{0}".format(TellStore.approach)
elif Storage.storage == Kudu:
default_out = "mbench_kudu"
elif Storage.storage == Cassandra:
default_out = "mbench_cassandra"
default_out = '{0}/{1}_sf{2}_N{3}'.format(Microbench.result_dir, default_out, Microbench.scaling, Microbench.numColumns)
if (uoutFile):
outfile = uoutFile
else:
outfile = default_out
appendFile = 0
while os.path.isfile(outfile + ".db"):
appendFile = appendFile + 1
outfile = "{0}_{1}".format(outfile, appendFile)
probabilities = "-i {0} -d {1} -u {2}".format(Microbench.insertProb, Microbench.deleteProb, Microbench.updateProb)
cmd = '{0}/watch/microbench/mbclient -H "{1}" -s {2} -c {3} -t {4} -a {5} -o {6} -b {7} -w {8} {9}'.format(TellStore.builddir, Microbench.getServerList(), Microbench.scaling, Microbench.clients, Microbench.clientThreads, Microbench.analyticalClients, outfile + ".db", Microbench.txBatch, Microbench.oltpWaitTime, probabilities)
if Microbench.onlyQ1:
cmd += ' -q'
if Microbench.noWarmUp:
cmd += " --no-warmup"
if (populate):
cmd += ' -P'
print "Execute {0}".format(cmd)
return os.system(cmd)
if __name__ == "__main__":
default_out = ''
parser = ArgumentParser()
parser.add_argument("-P", dest='populate', help="Populate data", action="store_true")
parser.add_argument("outfile", help="Result database", default=default_out, nargs='?')
args = parser.parse_args()
if (default_out != ''):
exit(startMBClient(args.populate, default_out))
else:
exit(startMBClient(args.populate))