aboutsummaryrefslogtreecommitdiffstats
path: root/restful_server
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-10-06 15:32:37 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-10-07 06:40:20 +0800
commit248e724a636907c5629ade8fe9febf6a3cec1dc6 (patch)
treec11d4c0ad5a80a6a404fcf534d859f758bd090e1 /restful_server
parent16385d37f66e121d0ef045e679ade1fd1aec9afc (diff)
Add benchmark name in post request parameters
Change-Id: I53974789d59f316afa72fb753397baa45247e64c Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'restful_server')
-rw-r--r--restful_server/qtip_server.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py
index 734a471c..e036a1cb 100644
--- a/restful_server/qtip_server.py
+++ b/restful_server/qtip_server.py
@@ -27,9 +27,10 @@ class JobModel:
'max-minutes': fields.Integer,
'pod_name': fields.String,
'suite_name': fields.String,
- 'type': fields.String
+ 'type': fields.String,
+ 'benchmark_name': fields.String
}
- required = ['installer_type', 'install_ip']
+ required = ['installer_type', 'installer_ip']
@swagger.model
@@ -99,6 +100,8 @@ for any single test iteration, default is '60',
"suite_name": If specified, Test suite name, for example 'compute', 'network', 'storage',
default is 'compute'
"type": BM or VM,default is 'BM'
+"benchmark_name": If specified, benchmark name in suite, for example 'dhrystone_bm.yaml',
+default is all benchmarks in suite with specified type
""",
"required": True,
"type": "JobModel",
@@ -129,6 +132,7 @@ default is 'compute'
parser.add_argument('pod_name', type=str, required=False, default='default', help='pod_name should be string')
parser.add_argument('suite_name', type=str, required=False, default='compute', help='suite_name should be string')
parser.add_argument('type', type=str, required=False, default='BM', help='type should be BM, VM and ALL')
+ parser.add_argument('benchmark_name', type=str, required=False, default='all', help='benchmark_name should be string')
args = parser.parse_args()
if not args_handler.check_suit_in_test_list(args["suite_name"]):
return abort(404, 'message:Test Suit {0} does not exist in test_list'.format(args["suite_name"]))
@@ -146,6 +150,11 @@ default is 'compute'
args["suite_name"],
args["type"].lower())
benchmarks_list = filter(lambda x: x in test_cases, benchmarks)
+ if args["benchmark_name"] in benchmarks_list:
+ benchmarks_list = [args["benchmark_name"]]
+ if (args["benchmark_name"] is not 'all') and args["benchmark_name"] not in benchmarks_list:
+ return abort(404, 'message: Benchmark name {0} does not exist in suit {1}'.format(args["benchmark_name"],
+ args["suite_name"]))
state_detail = map(lambda x: {'benchmark': x, 'state': 'idle'}, benchmarks_list)
db.update_job_state_detail(job_id, copy(state_detail))
thread_stop = threading.Event()