forked from apavlo/h-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
votefilegenerator
executable file
·102 lines (94 loc) · 3.48 KB
/
votefilegenerator
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Copyright (C) 2012 by H-Store Project
# Brown University
# Massachusetts Institute of Technology
# Yale University
#
# http://hstore.cs.brown.edu/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# -----------------------------------------------------------------------
from __future__ import with_statement
import os
import sys
import subprocess
import logging
from glob import glob
## H-Store Third-Party Libraries
realpath = os.path.realpath(__file__)
basedir = os.path.dirname(realpath)
if not os.path.exists(realpath):
cwd = os.getcwd()
basename = os.path.basename(realpath)
if os.path.exists(os.path.join(cwd, basename)):
basedir = cwd
sys.path.append(os.path.realpath(os.path.join(basedir, "third_party/python")))
sys.path.append(os.path.realpath(os.path.join(basedir, "tools")))
import hstore
import argparse
logging.basicConfig(level = logging.INFO,
format="%(asctime)s %(levelname)-5s: %(message)s",
datefmt="%m-%d-%Y %H:%M:%S",
stream = sys.stdout)
THIRD_PARTY_DIR = "third_party/java/jars"
BUILD_DIR = "obj/release/prod"
BUILD_1_DIR = "obj/release/benchmarks"
JVM_ARGS = [
"-client",
"-Xmx2048m",
"-Dlog4j.configuration=log4j.properties",
"-ea",
]
JVM_CLASSPATH = [ BUILD_DIR ] + glob("%s/*.jar" % THIRD_PARTY_DIR)
JVM_TARGET = "edu.brown.stream.VoteFileGenerator"
## ==============================================
## main
## ==============================================
if __name__ == '__main__':
aparser = argparse.ArgumentParser(description='S-Store Vote File Generator')
aparser.add_argument('--method', type=int,
help='shuffle method to disorder the vote sequence.')
aparser.add_argument('--size', type=int,
help='size for call generation.')
args = vars(aparser.parse_args())
# Options
options = [ ]
for key in ('method', 'size'):
if key in args and args[key]:
options.append("shuffle.%s=%s" % (key, args[key]))
#end for
# Invoke java directly
cmd = "java %s -classpath %s %s %s" % (\
" ".join(JVM_ARGS), \
":".join(JVM_CLASSPATH), \
JVM_TARGET, \
" ".join(options))
#logging.error(cmd)
logging.debug(cmd)
#sys.stdout.write(cmd);
try:
p = subprocess.Popen(cmd, shell=True)
p.wait()
except:
pass
sys.exit(p.returncode)
## MAIN