summaryrefslogtreecommitdiffstats
path: root/dashboard/pushtoDB.py
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-07-12 22:36:43 +0800
committerzhifeng jiang <jiang.zhifeng@zte.com.cn>2016-07-13 01:51:02 +0000
commitf385a6d107b3c5c479583e74e18ef3c5fa55b304 (patch)
treed28028bc5fd404ae560ee6cb21e0dc365ac7c550 /dashboard/pushtoDB.py
parent01c843df1684678072988283b3789e11a34b7499 (diff)
Fix pep8 errors for python files in benchmarks,data,dashboard
JIRA:QTIP-89 Change-Id: I3465221f0bdc9a8eb7c4e26069f7367fb1add729 Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'dashboard/pushtoDB.py')
-rw-r--r--dashboard/pushtoDB.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/dashboard/pushtoDB.py b/dashboard/pushtoDB.py
index 75c1d612..d5458b1d 100644
--- a/dashboard/pushtoDB.py
+++ b/dashboard/pushtoDB.py
@@ -2,21 +2,25 @@ import requests
import json
import datetime
import os
+import sys
TEST_DB = 'http://testresults.opnfv.org/test/api/v1'
-suite_list = [('compute_result.json', 'compute_test_suite'),('network_result.json', 'network_test_suite'),('storage_result.json', 'storage_test_suite')]
-payload_list = { }
+suite_list = [('compute_result.json', 'compute_test_suite'),
+ ('network_result.json', 'network_test_suite'),
+ ('storage_result.json', 'storage_test_suite')]
+payload_list = {}
-def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-pod1"):
+
+def push_results_to_db(db_url, case_name, payload, logger=None, pod_name="dell-pod1"):
url = db_url + "/results"
- creation_date= str(datetime.datetime.utcnow().isoformat())
+ creation_date = str(datetime.datetime.utcnow().isoformat())
installer = os.environ['INSTALLER_TYPE']
pod_name = os.environ['NODE_NAME']
params = {"project_name": "qtip", "case_name": case_name,
"pod_name": pod_name, "installer": installer, "start_date": creation_date,
- "version": "test" , "details": payload}
+ "version": "test", "details": payload}
headers = {'Content-Type': 'application/json'}
print pod_name
@@ -31,13 +35,15 @@ def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-po
print "Error:", sys.exc_info()[0]
return False
+
def populate_payload(suite_list):
global payload_list
- for k,v in suite_list:
+ for k, v in suite_list:
+
+ if os.path.isfile('results/' + str(k)):
+ payload_list[k] = v
- if os.path.isfile('results/'+str(k)):
- payload_list[k]=v
def main():
@@ -45,10 +51,10 @@ def main():
populate_payload(suite_list)
if payload_list:
print payload_list
- for suite,case in payload_list.items():
- with open('results/'+suite,'r') as result_file:
- j=json.load(result_file)
- push_results_to_db(TEST_DB, case , j)
+ for suite, case in payload_list.items():
+ with open('results/' + suite, 'r') as result_file:
+ j = json.load(result_file)
+ push_results_to_db(TEST_DB, case, j)
elif not payload_list:
print 'Results not found'