aboutsummaryrefslogtreecommitdiffstats
path: root/restful_server
diff options
context:
space:
mode:
Diffstat (limited to 'restful_server')
-rw-r--r--restful_server/db.py11
-rw-r--r--restful_server/qtip_server.py10
2 files changed, 15 insertions, 6 deletions
diff --git a/restful_server/db.py b/restful_server/db.py
index 916fc031..cf6ebfbb 100644
--- a/restful_server/db.py
+++ b/restful_server/db.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
from datetime import datetime
+from operator import add
import uuid
jobs = {}
@@ -28,7 +29,8 @@ def create_job(args):
'end_time': None,
'state': 'processing',
'state_detail': [],
- 'result': []}
+ 'result': None,
+ 'result_detail': []}
jobs[job['job_id']] = job
return job['job_id']
@@ -54,6 +56,8 @@ def get_job_info(job_id):
def finish_job(job_id):
jobs[job_id]['end_time'] = str(datetime.now())
jobs[job_id]['state'] = 'finished'
+ jobs[job_id]['result'] = reduce(add, map(lambda x: x['result'],
+ jobs[job_id]['result_detail']))
del threads[job_id]
@@ -61,8 +65,9 @@ def update_job_state_detail(job_id, state_detail):
jobs[job_id]['state_detail'] = state_detail
-def update_job_result(job_id, result):
- jobs[job_id]['result'] = result
+def update_job_result_detail(job_id, benchmark, result):
+ result['benchmark'] = benchmark
+ jobs[job_id]['result_detail'].append(result)
def is_job_timeout(job_id):
diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py
index b03c8f16..734a471c 100644
--- a/restful_server/qtip_server.py
+++ b/restful_server/qtip_server.py
@@ -163,8 +163,12 @@ default is 'compute'
if db.is_job_timeout(job_id) or stop_event.is_set():
break
db.update_benmark_state_in_state_detail(job_id, benchmark, 'processing')
- args_handler.prepare_and_run_benchmark(installer_type, '/home',
- args_handler.get_benchmark_path(pod_name, suite_name, benchmark))
+ result = args_handler.prepare_and_run_benchmark(installer_type,
+ '/home',
+ args_handler.get_benchmark_path(pod_name,
+ suite_name,
+ benchmark))
+ db.update_job_result_detail(job_id, benchmark, copy(result))
db.update_benmark_state_in_state_detail(job_id, benchmark, 'finished')
db.finish_job(job_id)
@@ -173,4 +177,4 @@ api.add_resource(JobList, '/api/v1.0/jobs')
api.add_resource(Job, '/api/v1.0/jobs/<string:id>')
if __name__ == "__main__":
- app.run()
+ app.run(host='0.0.0.0')