Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103346491
ycsb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 1, 08:42
Size
3 KB
Mime Type
text/x-python
Expires
Mon, Mar 3, 08:42 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24540012
Attached To
R7507 YCSB
ycsb
View Options
#!/usr/bin/env python
import
os
import
sys
import
subprocess
COMMANDS
=
{
"load"
:
{
"command"
:
"-load"
,
"description"
:
"Execute the load phase"
,
},
"run"
:
{
"command"
:
"-t"
,
"description"
:
"Execute the transaction phase"
,
},
}
DATABASES
=
{
"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"
,
"gemfire"
:
"com.yahoo.ycsb.db.GemFireClient"
,
"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"
,
"nosqldb"
:
"com.yahoo.ycsb.db.NoSqlDbClient"
,
"redis"
:
"com.yahoo.ycsb.db.RedisClient"
,
"voldemort"
:
"com.yahoo.ycsb.db.VoldemortClient"
,
}
OPTIONS
=
{
"-p key=value"
:
"Override workload property"
,
"-s"
:
"Print status to stderr"
,
"-target n"
:
"Target ops/sec (default: unthrottled)"
,
"-threads n"
:
"Number of client threads (default: 1)"
,
}
def
usage
():
print
"Usage:
%s
command database workload-file [options]"
%
sys
.
argv
[
0
]
print
"
\n
Commands:"
for
command
in
sorted
(
COMMANDS
.
keys
()):
print
" {0:13} {1}"
.
format
(
command
,
COMMANDS
[
command
][
"description"
])
print
"
\n
Databases:"
for
db
in
sorted
(
DATABASES
.
keys
()):
print
"
%s
"
%
db
print
"""
\n
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
"
\n
Options:"
for
option
in
sorted
(
OPTIONS
.
keys
()):
print
" {0:13} {1}"
.
format
(
option
,
OPTIONS
[
option
])
sys
.
exit
(
1
)
def
find_jars
(
dir
,
database
):
jars
=
[]
for
(
dirpath
,
dirnames
,
filenames
)
in
os
.
walk
(
dir
):
if
dirpath
.
endswith
(
"conf"
):
jars
.
append
(
dirpath
)
for
filename
in
filenames
:
if
filename
.
endswith
(
".jar"
)
and
\
filename
.
startswith
(
"core"
)
or
\
filename
.
startswith
(
database
.
split
(
"-"
)[
0
]):
jars
.
append
(
os
.
path
.
join
(
dirpath
,
filename
))
return
jars
def
get_ycsb_home
():
dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
while
"CHANGELOG"
not
in
os
.
listdir
(
dir
):
dir
=
os
.
path
.
join
(
dir
,
os
.
path
.
pardir
)
return
os
.
path
.
abspath
(
dir
)
if
len
(
sys
.
argv
)
<
4
:
usage
()
if
sys
.
argv
[
1
]
not
in
COMMANDS
:
print
"ERROR: Command '
%s
' not found"
%
sys
.
argv
[
1
]
usage
()
if
sys
.
argv
[
2
]
not
in
DATABASES
:
print
"ERROR: Database '
%s
' not found"
%
sys
.
argv
[
2
]
usage
()
ycsb_home
=
get_ycsb_home
()
command
=
COMMANDS
[
sys
.
argv
[
1
]][
"command"
]
database
=
sys
.
argv
[
2
]
db_classname
=
DATABASES
[
database
]
workload
=
sys
.
argv
[
3
]
options
=
sys
.
argv
[
4
:]
ycsb_command
=
[
"java"
,
"-cp"
,
":"
.
join
(
find_jars
(
ycsb_home
,
database
)),
\
"com.yahoo.ycsb.Client"
,
command
,
"-db"
,
db_classname
,
\
"-P"
,
workload
]
+
options
subprocess
.
call
(
ycsb_command
)
Event Timeline
Log In to Comment