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_case(args):
26 case_name = args['testcase']
28 return result_handler(consts.API_ERROR, 'testcase must be provided')
30 testcase = os.path.join(consts.TESTCASE_DIR, '{}.yaml'.format(case_name))
32 task_id = str(uuid.uuid4())
35 'inputfile': [testcase],
38 task_args.update(args.get('opts', {}))
40 param = Param(task_args)
41 task_thread = TaskThread(Task().start, param)
44 return result_handler(consts.API_SUCCESS, {'task_id': task_id})