aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-10-13 23:43:31 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-10-20 22:41:26 +0800
commit6a0eaa8c0b7bd74261a43e805e7d8cd8498e7845 (patch)
tree2f841c16968edf63a3593d2e0cea4b0d48712fa9
parent00928695ecae5e7565bc82d22bb807d2603a6d98 (diff)
Push test results to testdb at the end of qtip_server job.
JIRA:QTIP-99 Change-Id: I2a3ba25c1bcb66cf71a65757c3f003838dca614f Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
-rw-r--r--restful_server/qtip_server.py8
-rw-r--r--restful_server/result_handler.py2
-rw-r--r--scripts/__init__.py0
-rw-r--r--scripts/ref_results/suite_result.py3
4 files changed, 10 insertions, 3 deletions
diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py
index f2676595..d9dc52ad 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__)
@@ -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)
diff --git a/restful_server/result_handler.py b/restful_server/result_handler.py
index 059a2510..200330cb 100644
--- a/restful_server/result_handler.py
+++ b/restful_server/result_handler.py
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import json
-import data.ref_results.suite_result as suite_result
+import scripts.ref_results.suite_result as suite_result
import dashboard.pushtoDB as push_to_db
diff --git a/scripts/__init__.py b/scripts/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/scripts/__init__.py
diff --git a/scripts/ref_results/suite_result.py b/scripts/ref_results/suite_result.py
index d0b4647f..4d9eae08 100644
--- a/scripts/ref_results/suite_result.py
+++ b/scripts/ref_results/suite_result.py
@@ -15,7 +15,8 @@ logger = logger_utils.QtipLogger('suite_result').get
def get_benchmark_result(benchmark_name, suite_name):
- benchmark_indices = importlib.import_module('{0}_benchmarks_indices'.format(suite_name))
+ benchmark_indices = importlib.import_module('scripts.ref_results'
+ '.{0}_benchmarks_indices'.format(suite_name))
methodToCall = getattr(benchmark_indices, '{0}_index'.format(benchmark_name))
return methodToCall()