aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yardstick/cmd/cli.py35
-rw-r--r--yardstick/cmd/commands/task.py2
2 files changed, 34 insertions, 3 deletions
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py
index dd74836cb..f2406bf08 100644
--- a/yardstick/cmd/cli.py
+++ b/yardstick/cmd/cli.py
@@ -101,8 +101,7 @@ class YardstickCLI():
cmd_subparsers = subparser.add_subparsers(title='subcommands')
self._find_actions(cmd_subparsers, command_object)
- def main(self, argv):
- '''run the command line interface'''
+ def _register_cli_opt(self):
# register subcommands to parse additional command line arguments
def parser(subparsers):
@@ -114,10 +113,14 @@ class YardstickCLI():
handler=parser)
CONF.register_cli_opt(category_opt)
+ def _load_cli_config(self, argv):
+
# load CLI args and config files
CONF(argv, project="yardstick", version=self._version,
default_config_files=find_config_files(CONFIG_SEARCH_PATHS))
+ def _handle_global_opts(self):
+
# handle global opts
logger = logging.getLogger('yardstick')
logger.setLevel(logging.WARNING)
@@ -128,6 +131,34 @@ class YardstickCLI():
if CONF.debug:
logger.setLevel(logging.DEBUG)
+ def _dispath_func_notask(self):
+
# dispatch to category parser
func = CONF.category.func
func(CONF.category)
+
+ def _dispath_func_task(self, task_id, timestamp):
+
+ # dispatch to category parser
+ func = CONF.category.func
+ func(CONF.category, task_id=task_id, timestamp=timestamp)
+
+ def main(self, argv): # pragma: no cover
+ '''run the command line interface'''
+ self._register_cli_opt()
+
+ self._load_cli_config(argv)
+
+ self._handle_global_opts()
+
+ self._dispath_func_notask()
+
+ def api(self, argv, task_id, timestamp): # pragma: no cover
+ '''run the api interface'''
+ self._register_cli_opt()
+
+ self._load_cli_config(argv)
+
+ self._handle_global_opts()
+
+ self._dispath_func_task(task_id, timestamp)
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index b38e084ac..a10a2a8a3 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -51,7 +51,7 @@ class TaskCommands(object):
output_file_default, default=output_file_default)
@cliargs("--suite", help="process test suite file instead of a task file",
action="store_true")
- def do_start(self, args):
+ def do_start(self, args, **kwargs):
'''Start a benchmark scenario.'''
atexit.register(atexit_handler)