Skip to content

Commit

Permalink
gh-66 small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ch1 committed Feb 19, 2012
1 parent c40b53e commit c895c64
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 23 deletions.
3 changes: 2 additions & 1 deletion distribution/pom.xml
Expand Up @@ -8,7 +8,7 @@
<version>0.1.3</version>
</parent>

<artifactId>ycsb-distribution</artifactId>
<artifactId>ycsb</artifactId>
<name>YCSB Release Distribution Builder</name>
<packaging>pom</packaging>

Expand Down Expand Up @@ -81,6 +81,7 @@
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
Expand Down
61 changes: 40 additions & 21 deletions distribution/src/main/bin/ycsb
Expand Up @@ -5,22 +5,28 @@ import sys
import subprocess

COMMANDS = {
"load" : "-load",
"run" : "-t",
"load" : {
"command" : "-load",
"description" : "Execute the load phase",
},
"run" : {
"command" : "-t",
"description" : "Execute the transaction phase",
},
}

DATABASES = {
"basic" : "com.yahoo.ycsb.BasicDB",
"cassandra7" : "com.yahoo.ycsb.db.CassandraClient7",
"cassandra8" : "com.yahoo.ycsb.db.CassandraClient8",
"cassandra10" : "com.yahoo.ycsb.db.CassandraClient10",
"hbase" : "com.yahoo.ycsb.db.HBaseClient",
"infispan" : "com.yahoo.ycsb.db.InfinispanClient",
"jbdc" : "com.yahoo.ycsb.db.JdbcDBClient",
"mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient",
"mongodb" : "com.yahoo.ycsb.db.MongoDbClient",
"redis" : "com.yahoo.ycsb.db.RedisClient",
"voldemort" : "com.yahoo.ycsb.db.VoldemortClient",
"basic" : "com.yahoo.ycsb.BasicDB",
"cassandra-7" : "com.yahoo.ycsb.db.CassandraClient7",
"cassandra-8" : "com.yahoo.ycsb.db.CassandraClient8",
"cassandra-10" : "com.yahoo.ycsb.db.CassandraClient10",
"hbase" : "com.yahoo.ycsb.db.HBaseClient",
"infinispan" : "com.yahoo.ycsb.db.InfinispanClient",
"jdbc" : "com.yahoo.ycsb.db.JdbcDBClient",
"mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient",
"mongodb" : "com.yahoo.ycsb.db.MongoDbClient",
"redis" : "com.yahoo.ycsb.db.RedisClient",
"voldemort" : "com.yahoo.ycsb.db.VoldemortClient",
}

OPTIONS = {
Expand All @@ -35,22 +41,34 @@ def usage():

print "Commands:"
for command in sorted(COMMANDS.keys()):
print " %s" % command
print " {0:13} {1}".format(command, COMMANDS[command]["description"])
print

print "Databases:"
for db in sorted(DATABASES.keys()):
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:"
for option in sorted(OPTIONS.keys()):
print " {0:13} {1}".format(option, OPTIONS[option])
sys.exit(1)

def find_jars(dir):
def find_jars(dir, database):
jars = []
print database
for (dirpath, dirnames, filenames) in os.walk(dir):
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))
return jars

Expand All @@ -66,15 +84,15 @@ def get_command():
if sys.argv[1] not in COMMANDS:
print "ERROR: Command '%s' not found" % sys.argv[1]
usage()
return COMMANDS[sys.argv[1]]
return COMMANDS[sys.argv[1]]["command"]

def get_database():
if len(sys.argv) < 3:
usage()
if sys.argv[2] not in DATABASES:
print "ERROR: Database '%s' not found" % sys.argv[2]
usage()
return DATABASES[sys.argv[2]]
return sys.argv[2], DATABASES[sys.argv[2]]

def get_workload():
if len(sys.argv) < 4:
Expand All @@ -86,10 +104,11 @@ def get_options():

ycsb_home = get_ycsb_home()
command = get_command()
database = get_database()
database, db_classname = get_database()
workload = get_workload()
options = get_options()
ycsb_command = ["java", "-cp", ":".join(find_jars(ycsb_home)), \
"com.yahoo.ycsb.Client", command, "-db", database, \
ycsb_command = ["java", "-cp", ":".join(find_jars(ycsb_home, database)), \
"com.yahoo.ycsb.Client", command, "-db", db_classname, \
"-P", workload] + options
print " ".join(ycsb_command)
subprocess.call(ycsb_command)
19 changes: 18 additions & 1 deletion pom.xml
Expand Up @@ -13,7 +13,24 @@
<description>
This is the top level project that builds, packages the core and all the DB bindings for YCSB infrastructure.
</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>
<maven.assembly.version>2.2.1</maven.assembly.version>
Expand Down

0 comments on commit c895c64

Please sign in to comment.