Skip to content
Snippets Groups Projects
Commit c895c641 authored by m1ch1's avatar m1ch1
Browse files

gh-66 small fixes

parent c40b53ee
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<version>0.1.3</version> <version>0.1.3</version>
</parent> </parent>
<artifactId>ycsb-distribution</artifactId> <artifactId>ycsb</artifactId>
<name>YCSB Release Distribution Builder</name> <name>YCSB Release Distribution Builder</name>
<packaging>pom</packaging> <packaging>pom</packaging>
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
<descriptors> <descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor> <descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors> </descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
......
...@@ -5,22 +5,28 @@ import sys ...@@ -5,22 +5,28 @@ import sys
import subprocess import subprocess
COMMANDS = { COMMANDS = {
"load" : "-load", "load" : {
"run" : "-t", "command" : "-load",
"description" : "Execute the load phase",
},
"run" : {
"command" : "-t",
"description" : "Execute the transaction phase",
},
} }
DATABASES = { DATABASES = {
"basic" : "com.yahoo.ycsb.BasicDB", "basic" : "com.yahoo.ycsb.BasicDB",
"cassandra7" : "com.yahoo.ycsb.db.CassandraClient7", "cassandra-7" : "com.yahoo.ycsb.db.CassandraClient7",
"cassandra8" : "com.yahoo.ycsb.db.CassandraClient8", "cassandra-8" : "com.yahoo.ycsb.db.CassandraClient8",
"cassandra10" : "com.yahoo.ycsb.db.CassandraClient10", "cassandra-10" : "com.yahoo.ycsb.db.CassandraClient10",
"hbase" : "com.yahoo.ycsb.db.HBaseClient", "hbase" : "com.yahoo.ycsb.db.HBaseClient",
"infispan" : "com.yahoo.ycsb.db.InfinispanClient", "infinispan" : "com.yahoo.ycsb.db.InfinispanClient",
"jbdc" : "com.yahoo.ycsb.db.JdbcDBClient", "jdbc" : "com.yahoo.ycsb.db.JdbcDBClient",
"mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient", "mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient",
"mongodb" : "com.yahoo.ycsb.db.MongoDbClient", "mongodb" : "com.yahoo.ycsb.db.MongoDbClient",
"redis" : "com.yahoo.ycsb.db.RedisClient", "redis" : "com.yahoo.ycsb.db.RedisClient",
"voldemort" : "com.yahoo.ycsb.db.VoldemortClient", "voldemort" : "com.yahoo.ycsb.db.VoldemortClient",
} }
OPTIONS = { OPTIONS = {
...@@ -35,22 +41,34 @@ def usage(): ...@@ -35,22 +41,34 @@ def usage():
print "Commands:" print "Commands:"
for command in sorted(COMMANDS.keys()): for command in sorted(COMMANDS.keys()):
print " %s" % command print " {0:13} {1}".format(command, COMMANDS[command]["description"])
print
print "Databases:" print "Databases:"
for db in sorted(DATABASES.keys()): for db in sorted(DATABASES.keys()):
print " %s" % db print " %s" % db
print
print """Workload Files:
There are various predefined workloads under workloads/ directory.
See https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties
for the list of workload properties.
"""
print "Options:" print "Options:"
for option in sorted(OPTIONS.keys()): for option in sorted(OPTIONS.keys()):
print " {0:13} {1}".format(option, OPTIONS[option]) print " {0:13} {1}".format(option, OPTIONS[option])
sys.exit(1) sys.exit(1)
def find_jars(dir): def find_jars(dir, database):
jars = [] jars = []
print database
for (dirpath, dirnames, filenames) in os.walk(dir): for (dirpath, dirnames, filenames) in os.walk(dir):
for filename in filenames: for filename in filenames:
if filename.endswith(".jar"): print filename
if filename.endswith(".jar") and \
filename.startswith("core") or filename.startswith(database.split("-")[0]):
print filename
jars.append(os.path.join(dirpath, filename)) jars.append(os.path.join(dirpath, filename))
return jars return jars
...@@ -66,7 +84,7 @@ def get_command(): ...@@ -66,7 +84,7 @@ def get_command():
if sys.argv[1] not in COMMANDS: if sys.argv[1] not in COMMANDS:
print "ERROR: Command '%s' not found" % sys.argv[1] print "ERROR: Command '%s' not found" % sys.argv[1]
usage() usage()
return COMMANDS[sys.argv[1]] return COMMANDS[sys.argv[1]]["command"]
def get_database(): def get_database():
if len(sys.argv) < 3: if len(sys.argv) < 3:
...@@ -74,7 +92,7 @@ def get_database(): ...@@ -74,7 +92,7 @@ def get_database():
if sys.argv[2] not in DATABASES: if sys.argv[2] not in DATABASES:
print "ERROR: Database '%s' not found" % sys.argv[2] print "ERROR: Database '%s' not found" % sys.argv[2]
usage() usage()
return DATABASES[sys.argv[2]] return sys.argv[2], DATABASES[sys.argv[2]]
def get_workload(): def get_workload():
if len(sys.argv) < 4: if len(sys.argv) < 4:
...@@ -86,10 +104,11 @@ def get_options(): ...@@ -86,10 +104,11 @@ def get_options():
ycsb_home = get_ycsb_home() ycsb_home = get_ycsb_home()
command = get_command() command = get_command()
database = get_database() database, db_classname = get_database()
workload = get_workload() workload = get_workload()
options = get_options() options = get_options()
ycsb_command = ["java", "-cp", ":".join(find_jars(ycsb_home)), \ ycsb_command = ["java", "-cp", ":".join(find_jars(ycsb_home, database)), \
"com.yahoo.ycsb.Client", command, "-db", database, \ "com.yahoo.ycsb.Client", command, "-db", db_classname, \
"-P", workload] + options "-P", workload] + options
print " ".join(ycsb_command)
subprocess.call(ycsb_command) subprocess.call(ycsb_command)
...@@ -13,7 +13,24 @@ ...@@ -13,7 +13,24 @@
<description> <description>
This is the top level project that builds, packages the core and all the DB bindings for YCSB infrastructure. This is the top level project that builds, packages the core and all the DB bindings for YCSB infrastructure.
</description> </description>
<dependencies>
<!-- voldemort -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>
<!--
Nail down slf4j version to 1.6 so that it defaults to no-op logger.
http://www.slf4j.org/codes.html#StaticLoggerBinder
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
<!-- Properties Management --> <!-- Properties Management -->
<properties> <properties>
<maven.assembly.version>2.2.1</maven.assembly.version> <maven.assembly.version>2.2.1</maven.assembly.version>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment