Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MB-6740: Pass -v option to cbtransfer

Need to treat -v differently from other options. Need to intrepret
verbose level to reconstruct it as arguments

Change-Id: I84ddde96f558a605e296626f4bf37311d299a379
Reviewed-on: http://review.couchbase.org/21251
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
  • Loading branch information...
commit 4ee17fd815f97d579a7eadb9becd269e7133a30b 1 parent 8f25576
@bcui6611 bcui6611 authored Peter Wansch committed
Showing with 15 additions and 3 deletions.
  1. +15 −3 cbworkloadgen
View
18 cbworkloadgen
@@ -29,15 +29,20 @@ class WorkloadGen(pump_transfer.Transfer):
def main(self, argv):
- src, sink, common_opts = self.opt_construct(argv)
+ src, sink, common_opts, count_opts = self.opt_construct(argv)
local_args = [argv[0]]
local_args.append(src)
local_args.append(sink)
- for k, v in common_opts.iteritems():
+ for v in common_opts.itervalues():
local_args.append(v[0])
local_args.append(v[1])
+ for v in count_opts.itervalues():
+ if v[1] is not None:
+ for i in range(v[1]):
+ local_args.append(v[0])
+
pump_transfer.Transfer.main(self, local_args)
def opt_construct(self, argv):
@@ -57,6 +62,8 @@ class WorkloadGen(pump_transfer.Transfer):
"password" : ["-p", None],
}
+ count_opts = {"verbose" : ["-v", None]}
+
p = optparse.OptionParser(usage=self.usage)
self.add_parser_options(p)
opts, rest = p.parse_args(argv[1:])
@@ -81,7 +88,12 @@ class WorkloadGen(pump_transfer.Transfer):
if val:
common_opts[key][1] = str(val)
- return gen_str, sink_str, common_opts
+ for key in count_opts.iterkeys():
+ val = getattr(opts, key, None)
+ if val:
+ count_opts[key][1] = int(val)
+
+ return gen_str, sink_str, common_opts, count_opts
def add_parser_options(self, p):
p.add_option("-r", "--ratio-sets",
Please sign in to comment.
Something went wrong with that request. Please try again.