1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 from __future__ import absolute_import
14 from api.utils.common import result_handler
15 from api.utils.thread import TaskThread
16 from yardstick.common import constants as consts
17 from yardstick.benchmark.core import Param
18 from yardstick.benchmark.core.task import Task
20 logger = logging.getLogger(__name__)
21 logger.setLevel(logging.DEBUG)
24 def run_test_suite(args):
26 suite_name = args['testsuite']
28 return result_handler(consts.API_ERROR, 'testsuite must be provided')
30 testsuite = os.path.join(consts.TESTSUITE_DIR,
31 '{}.yaml'.format(suite_name))
33 task_id = str(uuid.uuid4())
36 'inputfile': [testsuite],
40 task_args.update(args.get('opts', {}))
42 param = Param(task_args)
43 task_thread = TaskThread(Task().start, param)
46 return result_handler(consts.API_SUCCESS, {'task_id': task_id})