diff options
Diffstat (limited to 'dashboard/pushtoDB.py')
-rw-r--r-- | dashboard/pushtoDB.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/dashboard/pushtoDB.py b/dashboard/pushtoDB.py index b889f21c..d9d48f5a 100644 --- a/dashboard/pushtoDB.py +++ b/dashboard/pushtoDB.py @@ -7,24 +7,20 @@ TEST_DB = 'http://213.77.62.197' 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-us-testing-1"):
+def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-bm-1"):
url = db_url + "/results"
creation_date= str(datetime.datetime.utcnow().isoformat())
installer = os.environ['INSTALLER_TYPE']
- #pod_name = os.environ['NODE_NAME']
- print url
- print case_name
- print logger
- print pod_name
-
+ pod_name = os.environ['NODE_NAME']
+
params = {"project_name": "qtip", "case_name": case_name,
"pod_name": pod_name, "installer": installer, "creation_date": creation_date,
"version": "test" , "details": payload}
headers = {'Content-Type': 'application/json'}
- print params
-
+ print json.dumps(params)
+
try:
r = requests.post(url, data=json.dumps(params), headers=headers)
print r
@@ -32,26 +28,23 @@ def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us except:
print "Error:", sys.exc_info()[0]
return False
-
+
def populate_payload(suite_list):
global payload_list
for k,v in suite_list:
- print 'results/'+k
+
if os.path.isfile('results/'+str(k)):
payload_list[k]=v
-
- print payload_list
def main():
global payload_list
populate_payload(suite_list)
for suite,case in payload_list.items():
- with open('results/'+suite,'r') as result_file:
- j=result_file.read().rstrip()
-
- push_results_to_db(TEST_DB, 'Compute benchmark suite',j)
+ with open('results/'+suite,'r') as result_file:
+ j=json.load(result_file)
+ push_results_to_db(TEST_DB, case , j)
if __name__ == "__main__":
main()
|