From: Ondrej Lichtner olichtne@redhat.com
Exceptions raised by the PerfRepo library currently cause the entire test to stop. This commit changes the behaviour by catching all these exceptions, logging them with log level ERROR and returning to test execution. This way the test will continue so that the tester can at least manually confirm the results even when the result/baseline database is unreachable.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/Task.py | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index f9a15f2..019acc2 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -867,9 +867,17 @@ class PerfRepoAPI(object): logging.debug("Test key '%s' mapped to id '%s'" % (mapping_key, mapping_id))
- test = self._rest_api.test_get_by_id(mapping_id, log=False) + try: + test = self._rest_api.test_get_by_id(mapping_id, log=False) + except Exception as e: + test = None + logging.error(str(e)) if test is None: - test = self._rest_api.test_get_by_uid(mapping_id, log=False) + try: + test = self._rest_api.test_get_by_uid(mapping_id, log=False) + except Exception as e: + test = None + logging.error(str(e))
if test is not None: test_url = self._rest_api.get_obj_url(test) @@ -897,7 +905,11 @@ class PerfRepoAPI(object): logging.debug("Adding hash '%s' as tag to result." % h) result.add_tag(h) logging.info("Sending TestExecution to PerfRepo.") - self._rest_api.testExecution_create(result.get_testExecution()) + try: + self._rest_api.testExecution_create(result.get_testExecution()) + except Exception as e: + logging.error(str(e)) + return
report_id = self._mapping.get_id(h) if not report_id and result.get_testExecution().get_id() != None: @@ -928,7 +940,11 @@ class PerfRepoAPI(object): if report_id is None or not self.connected(): return Noop()
- report = self._rest_api.report_get_by_id(report_id, log=False) + try: + report = self._rest_api.report_get_by_id(report_id, log=False) + except Exception as e: + report = None + logging.error(str(e)) if report is None: logging.debug("No report with id %s found!" % report_id) return Noop() @@ -943,11 +959,19 @@ class PerfRepoAPI(object): return Noop()
baseline_exec_id = baseline["execId"] - baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id, - log=False) - - logging.debug("TestExecution of baseline: %s" %\ - self._rest_api.get_obj_url(baseline_testExec)) + try: + baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id, + log=False) + except Exception as e: + baseline_testExec = None + logging.error(str(e)) + + if baseline_testExec is not None: + logging.debug("TestExecution of baseline: %s" %\ + self._rest_api.get_obj_url(baseline_testExec)) + else: + logging.debug("Couldn't get TestExecution of baseline.") + return Noop() return PerfRepoBaseline(baseline_testExec)
def get_baseline_of_result(self, result):
On Fri, Sep 16, 2016 at 06:20:13PM +0200, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
Exceptions raised by the PerfRepo library currently cause the entire test to stop. This commit changes the behaviour by catching all these exceptions, logging them with log level ERROR and returning to test execution. This way the test will continue so that the tester can at least manually confirm the results even when the result/baseline database is unreachable.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
lnst/Controller/Task.py | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index f9a15f2..019acc2 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -867,9 +867,17 @@ class PerfRepoAPI(object): logging.debug("Test key '%s' mapped to id '%s'" % (mapping_key, mapping_id))
test = self._rest_api.test_get_by_id(mapping_id, log=False)
try:
test = self._rest_api.test_get_by_id(mapping_id, log=False)
except Exception as e:
test = None
logging.error(str(e)) if test is None:
test = self._rest_api.test_get_by_uid(mapping_id, log=False)
try:
test = self._rest_api.test_get_by_uid(mapping_id, log=False)
except Exception as e:
test = None
logging.error(str(e)) if test is not None: test_url = self._rest_api.get_obj_url(test)
@@ -897,7 +905,11 @@ class PerfRepoAPI(object): logging.debug("Adding hash '%s' as tag to result." % h) result.add_tag(h) logging.info("Sending TestExecution to PerfRepo.")
self._rest_api.testExecution_create(result.get_testExecution())
try:
self._rest_api.testExecution_create(result.get_testExecution())
except Exception as e:
logging.error(str(e))
return report_id = self._mapping.get_id(h) if not report_id and result.get_testExecution().get_id() != None:
@@ -928,7 +940,11 @@ class PerfRepoAPI(object): if report_id is None or not self.connected(): return Noop()
report = self._rest_api.report_get_by_id(report_id, log=False)
try:
report = self._rest_api.report_get_by_id(report_id, log=False)
except Exception as e:
report = None
logging.error(str(e)) if report is None: logging.debug("No report with id %s found!" % report_id) return Noop()
@@ -943,11 +959,19 @@ class PerfRepoAPI(object): return Noop()
baseline_exec_id = baseline["execId"]
baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id,
log=False)
logging.debug("TestExecution of baseline: %s" %\
self._rest_api.get_obj_url(baseline_testExec))
try:
baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id,
log=False)
except Exception as e:
baseline_testExec = None
logging.error(str(e))
if baseline_testExec is not None:
logging.debug("TestExecution of baseline: %s" %\
self._rest_api.get_obj_url(baseline_testExec))
else:
logging.debug("Couldn't get TestExecution of baseline.")
return Noop() return PerfRepoBaseline(baseline_testExec)
def get_baseline_of_result(self, result):
-- 2.9.3
pushed
lnst-developers@lists.fedorahosted.org