summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/daily.sh33
-rw-r--r--storperf/db/job_db.py7
-rw-r--r--storperf/storperf_master.py3
-rw-r--r--tests/db_tests/job_db_test.py2
4 files changed, 30 insertions, 15 deletions
diff --git a/ci/daily.sh b/ci/daily.sh
index 1e01cb8..e12964d 100755
--- a/ci/daily.sh
+++ b/ci/daily.sh
@@ -101,24 +101,35 @@ export TEST_CASE=snia_steady_state
JOB=`$WORKSPACE/ci/start_job.sh \
| awk '/job_id/ {print $2}' | sed 's/"//g'`
-JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
- | awk '/Status/ {print $2}' | cut -d\" -f2`
+curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
+ -o $WORKSPACE/ci/job/status.json
+
+JOB_STATUS=`cat $WORKSPACE/ci/job/status.json | awk '/Status/ {print $2}' | cut -d\" -f2`
while [ "$JOB_STATUS" != "Completed" ]
do
- sleep 60
- curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status"
- JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
- | awk '/Status/ {print $2}' | cut -d\" -f2`
+ sleep 600
+ mv $WORKSPACE/ci/job/status.json $WORKSPACE/ci/job/old-status.json
+ curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
+ -o $WORKSPACE/ci/job/status.json
+ JOB_STATUS=`cat $WORKSPACE/ci/job/status.json | awk '/Status/ {print $2}' | cut -d\" -f2`
+ diff $WORKSPACE/ci/job/status.json $WORKSPACE/ci/job/old-status.json >/dev/null
+ if [ $? -eq 1 ]
+ then
+ cat $WORKSPACE/ci/job/status.json
+ fi
done
-HREF=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
- | awk '/TestResultURL/ {print $2}' | cut -d\" -f2 | cut -d/ -f4-`
-
echo "Deleting stack for cleanup"
-curl -X DELETE --header 'Accept: application/json' 'http://127.0.0.1:5000/api/v1.0/configurations'
+curl -s -X DELETE --header 'Accept: application/json' 'http://127.0.0.1:5000/api/v1.0/configurations'
sudo chmod 777 -R $WORKSPACE/ci/job/carbon
-echo "Results published to: http://testresults.opnfv.org/test/$HREF"
+curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=metadata" \
+ -o $WORKSPACE/ci/job/report.json
+
+echo ==========================================================================
+echo Final report
+echo ==========================================================================
+cat $WORKSPACE/ci/job/report.json
exit 0
diff --git a/storperf/db/job_db.py b/storperf/db/job_db.py
index eabcb54..3308fa8 100644
--- a/storperf/db/job_db.py
+++ b/storperf/db/job_db.py
@@ -8,6 +8,7 @@
##############################################################################
import calendar
+import json
import logging
from sqlite3 import OperationalError
import sqlite3
@@ -249,6 +250,10 @@ class JobDB(object):
row = cursor.fetchone()
if (row is None):
break
- params[row[0]] = row[1]
+ try:
+ data = json.loads(row[1])
+ except:
+ data = row[1]
+ params[row[0]] = data
db.close()
return params
diff --git a/storperf/storperf_master.py b/storperf/storperf_master.py
index 6d9625c..d0e0dc1 100644
--- a/storperf/storperf_master.py
+++ b/storperf/storperf_master.py
@@ -8,7 +8,6 @@
##############################################################################
from datetime import datetime
-import json
import logging
import os
import socket
@@ -328,7 +327,7 @@ class StorPerfMaster(object):
workload_params = self.job_db.fetch_workload_params(job_id)
if 'report' in workload_params:
- report = json.loads(workload_params['report'])
+ report = workload_params['report']
return report['metrics']
return {}
diff --git a/tests/db_tests/job_db_test.py b/tests/db_tests/job_db_test.py
index ccfb9cc..9b09a80 100644
--- a/tests/db_tests/job_db_test.py
+++ b/tests/db_tests/job_db_test.py
@@ -186,7 +186,7 @@ class JobDBTest(unittest.TestCase):
self.assertEqual(start_time, row[3], "Did not expect " + str(row[3]))
def test_job_params(self):
- expected = {"a": "1", "b": "2"}
+ expected = {u"a": 1, u"b": 2}
self.job.job_id = "ABCD"
self.job.record_workload_params(expected)
actual = self.job.fetch_workload_params(self.job.job_id)