From 6ffbb81ec808aa615c7dad95fe6328ea5cc9c7b5 Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Sat, 21 Apr 2018 08:53:03 +0000 Subject: Add testing gating reporting page Change-Id: I9f46d684a11b7999defffe983fc3224ef1a50412 Signed-off-by: chenjiankun --- reporting/api/handlers/scenarios.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 reporting/api/handlers/scenarios.py (limited to 'reporting/api/handlers/scenarios.py') diff --git a/reporting/api/handlers/scenarios.py b/reporting/api/handlers/scenarios.py new file mode 100644 index 0000000..70447c7 --- /dev/null +++ b/reporting/api/handlers/scenarios.py @@ -0,0 +1,27 @@ +from tornado.web import asynchronous +from tornado.gen import coroutine +from tornado.escape import json_encode + +from api.handlers import BaseHandler +from api.service.scenario import ScenarioTableResult + + +class Result(BaseHandler): + @asynchronous + @coroutine + def get(self): + self._set_header() + + scenario = self.get_argument('scenario', None) + version = self.get_argument('version', 'master') + installer = self.get_argument('installer', None) + iteration = int(self.get_argument('iteration', 10)) + + yield self._get_scenario_data(scenario, version, installer, iteration) + + @coroutine + def _get_scenario_data(self, scenario, version, installer, iteration): + results = ScenarioTableResult(scenario, version, installer, iteration) + result = yield results.get() + self.write(json_encode(result)) + self.finish() -- cgit 1.2.3-korg