aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/cmd
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2016-11-17 08:01:14 +0000
committerchenjiankun <chenjiankun1@huawei.com>2016-11-21 08:59:40 +0000
commit0e23c697e6329a57ba168cc57886b436ea87cdc4 (patch)
tree9344c63ed5296375dda7b0f0f2a3d85c06d7048e /yardstick/cmd
parenteeeca4f0cdeff152ec061bb9b40ae305547c027e (diff)
Create API to run test cases
JIRA: YARDSTICK-413 Change-Id: Ibf58b50b568fae3f2eea985b25ee33be0a3666b7 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/cmd')
-rw-r--r--yardstick/cmd/cli.py8
-rw-r--r--yardstick/cmd/commands/task.py7
2 files changed, 8 insertions, 7 deletions
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py
index f2406bf08..3896ce47c 100644
--- a/yardstick/cmd/cli.py
+++ b/yardstick/cmd/cli.py
@@ -137,11 +137,11 @@ class YardstickCLI():
func = CONF.category.func
func(CONF.category)
- def _dispath_func_task(self, task_id, timestamp):
+ def _dispath_func_task(self, task_id):
# dispatch to category parser
func = CONF.category.func
- func(CONF.category, task_id=task_id, timestamp=timestamp)
+ func(CONF.category, task_id=task_id)
def main(self, argv): # pragma: no cover
'''run the command line interface'''
@@ -153,7 +153,7 @@ class YardstickCLI():
self._dispath_func_notask()
- def api(self, argv, task_id, timestamp): # pragma: no cover
+ def api(self, argv, task_id): # pragma: no cover
'''run the api interface'''
self._register_cli_opt()
@@ -161,4 +161,4 @@ class YardstickCLI():
self._handle_global_opts()
- self._dispath_func_task(task_id, timestamp)
+ self._dispath_func_task(task_id)
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index a10a2a8a3..47fb2ee60 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -56,6 +56,8 @@ class TaskCommands(object):
atexit.register(atexit_handler)
+ self.task_id = kwargs.get('task_id', str(uuid.uuid4()))
+
total_start_time = time.time()
parser = TaskParser(args.inputfile[0])
@@ -81,7 +83,7 @@ class TaskCommands(object):
one_task_start_time = time.time()
parser.path = task_files[i]
scenarios, run_in_parallel, meet_precondition = parser.parse_task(
- task_args[i], task_args_fnames[i])
+ self.task_id, task_args[i], task_args_fnames[i])
if not meet_precondition:
LOG.info("meet_precondition is %s, please check envrionment",
@@ -232,7 +234,7 @@ class TaskParser(object):
return valid_task_files, valid_task_args, valid_task_args_fnames
- def parse_task(self, task_args=None, task_args_file=None):
+ def parse_task(self, task_id, task_args=None, task_args_file=None):
'''parses the task file and return an context and scenario instances'''
print "Parsing task config:", self.path
@@ -291,7 +293,6 @@ class TaskParser(object):
run_in_parallel = cfg.get("run_in_parallel", False)
# add tc and task id for influxdb extended tags
- task_id = str(uuid.uuid4())
for scenario in cfg["scenarios"]:
task_name = os.path.splitext(os.path.basename(self.path))[0]
scenario["tc"] = task_name