Browse Source

Store error info in execution result when failed

This makes sure that users are told executions failed due to something
is wrong in Qinling engine.

Change-Id: I19abb2ad4abe955bf18550bce04499d2c4f9bbb5
Story: 2002043
Task: 19687
changes/69/571669/2
Hunt Xu 3 years ago
committed by Lingxian Kong
parent
commit
958b2d2594
2 changed files with 7 additions and 3 deletions
  1. +3
    -1
      qinling/engine/utils.py
  2. +4
    -2
      qinling/tests/unit/engine/test_default_engine.py

+ 3
- 1
qinling/engine/utils.py View File

@ -151,4 +151,6 @@ def handle_execution_exception(execution_id, exc_str):
LOG.error(
'Error running execution %s: %s', execution_id, exc_str
)
db_set_execution_status(execution_id, status.ERROR, '', {})
db_set_execution_status(
execution_id, status.ERROR, '', {'EngineError': exc_str}
)

+ 4
- 2
qinling/tests/unit/engine/test_default_engine.py View File

@ -324,7 +324,8 @@ class TestDefaultEngine(base.DbTestCase):
execution = db_api.get_execution(execution_id)
self.assertEqual(execution.status, status.ERROR)
self.assertEqual(execution.logs, '')
self.assertEqual(execution.result, {})
self.assertEqual(execution.result,
{'EngineError': 'Exception in prepare_execution'})
@mock.patch('qinling.utils.etcd_util.get_service_url')
def test_create_execution_package_type_function(
@ -385,7 +386,8 @@ class TestDefaultEngine(base.DbTestCase):
self.assertEqual(execution.status, status.ERROR)
self.assertEqual(execution.logs, '')
self.assertEqual(execution.result, {})
self.assertEqual(execution.result,
{'EngineError': 'Exception in scaleup_function'})
@mock.patch('qinling.engine.utils.get_request_data')
@mock.patch('qinling.engine.utils.url_request')


Loading…
Cancel
Save