Skip to content

Commit 26e431c

Browse files
committed
Allow discover mode to use -u, -c, -D, etc options
1 parent 31559f8 commit 26e431c

1 file changed

Lines changed: 37 additions & 37 deletions

File tree

src/funkload/BenchRunner.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -718,40 +718,6 @@ def parse_sys_args(sys_args):
718718
dest="config",
719719
metavar='CONFIG',
720720
help="Path to alternative config file")
721-
parser.add_option("-u", "--url",
722-
type="string",
723-
dest="main_url",
724-
help="Base URL to bench.")
725-
parser.add_option("-c", "--cycles",
726-
type="string",
727-
dest="bench_cycles",
728-
help="Cycles to bench, colon-separated list of "
729-
"virtual concurrent users. To run a bench with 3 "
730-
"cycles of 5, 10 and 20 users, use: -c 5:10:20")
731-
parser.add_option("-D", "--duration",
732-
type="string",
733-
dest="bench_duration",
734-
help="Duration of a cycle in seconds.")
735-
parser.add_option("-m", "--sleep-time-min",
736-
type="string",
737-
dest="bench_sleep_time_min",
738-
help="Minimum sleep time between requests.")
739-
parser.add_option("-M", "--sleep-time-max",
740-
type="string",
741-
dest="bench_sleep_time_max",
742-
help="Maximum sleep time between requests.")
743-
parser.add_option("-t", "--test-sleep-time",
744-
type="string",
745-
dest="bench_sleep_time",
746-
help="Sleep time between tests.")
747-
parser.add_option("-s", "--startup-delay",
748-
type="string",
749-
dest="bench_startup_delay",
750-
help="Startup delay between thread.")
751-
parser.add_option("-f", "--as-fast-as-possible",
752-
action="store_true",
753-
help="Remove sleep times between requests and between "
754-
"tests, shortcut for -m0 -M0 -t0")
755721
parser.add_option("-l", "--label",
756722
type="string",
757723
help="Add a label to this bench run for easier "
@@ -873,6 +839,40 @@ def get_shared_OptionParser():
873839
action="store_true",
874840
dest="failfast",
875841
help="Stop on first fail or error. (For discover mode)")
842+
parser.add_option("-u", "--url",
843+
type="string",
844+
dest="main_url",
845+
help="Base URL to bench.")
846+
parser.add_option("-c", "--cycles",
847+
type="string",
848+
dest="bench_cycles",
849+
help="Cycles to bench, colon-separated list of "
850+
"virtual concurrent users. To run a bench with 3 "
851+
"cycles of 5, 10 and 20 users, use: -c 5:10:20")
852+
parser.add_option("-D", "--duration",
853+
type="string",
854+
dest="bench_duration",
855+
help="Duration of a cycle in seconds.")
856+
parser.add_option("-m", "--sleep-time-min",
857+
type="string",
858+
dest="bench_sleep_time_min",
859+
help="Minimum sleep time between requests.")
860+
parser.add_option("-M", "--sleep-time-max",
861+
type="string",
862+
dest="bench_sleep_time_max",
863+
help="Maximum sleep time between requests.")
864+
parser.add_option("-t", "--test-sleep-time",
865+
type="string",
866+
dest="bench_sleep_time",
867+
help="Sleep time between tests.")
868+
parser.add_option("-s", "--startup-delay",
869+
type="string",
870+
dest="bench_startup_delay",
871+
help="Startup delay between thread.")
872+
parser.add_option("-f", "--as-fast-as-possible",
873+
action="store_true",
874+
help="Remove sleep times between requests and between "
875+
"tests, shortcut for -m0 -M0 -t0")
876876
return parser
877877

878878
def run_distributed(options, module_name, class_name, method_name, sys_args):
@@ -901,7 +901,7 @@ def run_distributed(options, module_name, class_name, method_name, sys_args):
901901

902902
_manager = None
903903
return ret
904-
904+
905905
def run_local(options, module_name, class_name, method_name):
906906
ret = None
907907
RunnerClass = get_runner_class(options.bench_runner_class)
@@ -933,9 +933,9 @@ def main(sys_args=sys.argv[1:]):
933933
# special case: 'discover' argument
934934
if sys_args and sys_args[0].lower() == 'discover':
935935
return discover(sys_args)
936-
936+
937937
options, args, module_name = parse_sys_args(sys_args)
938-
938+
939939
klass, method = args[1].split('.')
940940
if options.distribute:
941941
return run_distributed(options, module_name, klass, method, sys_args)

0 commit comments

Comments
 (0)