diff options
Diffstat (limited to 'restful_server/qtip_server.py')
-rw-r--r-- | restful_server/qtip_server.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py index f2676595..7b55020a 100644 --- a/restful_server/qtip_server.py +++ b/restful_server/qtip_server.py @@ -13,6 +13,7 @@ import threading from copy import copy import db import func.args_handler as args_handler +import restful_server.result_handler as result_handler app = Flask(__name__) @@ -145,8 +146,8 @@ default is all benchmarks in suite with specified type, help='testdb_url should be test db http url,for example http://testresults.opnfv.org/test/api/v1') parser.add_argument('node_name', type=str, required=False, default=None, help='node_name should be string') args = parser.parse_args() - if not args_handler.check_suite_in_test_list(args["suite_name"]): - return abort(404, 'message:Test suite {0} does not exist in test_list'.format(args["suite_name"])) + if not args_handler.check_suite(args["suite_name"]): + return abort(404, 'message:Test suite {0} does not exist under benchmarks/suite'.format(args["suite_name"])) if not args_handler.check_lab_name(args["pod_name"]): return abort(404, 'message: You have specified a lab {0}\ that is not present in test_cases'.format(args['pod_name'])) @@ -155,8 +156,8 @@ default is all benchmarks in suite with specified type, if not job_id: return abort(409, 'message:It already has one job running now!') - benchmarks = args_handler.get_files_in_test_list(args["suite_name"], - args["type"].lower()) + benchmarks = args_handler.get_files_in_suite(args["suite_name"], + args["type"].lower()) test_cases = args_handler.get_files_in_test_case(args["pod_name"], args["suite_name"], args["type"].lower()) @@ -174,11 +175,14 @@ default is all benchmarks in suite with specified type, args["pod_name"], args["suite_name"], job_id, + args["testdb_url"], + args["node_name"], thread_stop)) db.start_thread(job_id, post_thread, thread_stop) return {'job_id': str(job_id)} - def thread_post(self, installer_type, benchmarks_list, pod_name, suite_name, job_id, stop_event): + def thread_post(self, installer_type, benchmarks_list, pod_name, suite_name, + job_id, testdb_url, node_name, stop_event): for benchmark in benchmarks_list: if db.is_job_timeout(job_id) or stop_event.is_set(): break @@ -190,6 +194,8 @@ default is all benchmarks in suite with specified type, benchmark)) db.update_job_result_detail(job_id, benchmark, copy(result)) db.update_benchmark_state(job_id, benchmark, 'finished') + if (result_handler.dump_suite_result(suite_name) and testdb_url): + result_handler.push_suite_result_to_db(suite_name, testdb_url, installer_type, node_name) db.finish_job(job_id) |