Conductor send all the occurred exceptions to the API

Also, EnvironmentException thrown in the HeatExecutor now has a meaningful message

Change-Id: I8f93bdbc50ce777793e95c2d236de220d4b5c6dd
This commit is contained in:
Alexander Tivelkov
2013-07-30 19:22:22 +04:00
parent 7ec019f7bb
commit 773dcc9926
6 changed files with 52 additions and 18 deletions

View File

@@ -15,6 +15,7 @@
import glob
import sys
import traceback
import anyjson
import eventlet
@@ -76,6 +77,7 @@ class ConductorWorkflowService(service.Service):
def _task_received(self, message):
task = message.body or {}
message_id = message.id
reporter = None
with self.create_rmq_client() as mq:
try:
log.info('Starting processing task {0}: {1}'.format(
@@ -83,8 +85,10 @@ class ConductorWorkflowService(service.Service):
reporter = reporting.Reporter(mq, message_id, task['id'])
config = Config()
command_dispatcher = CommandDispatcher(
'e' + task['id'], mq, task['token'], task['tenant_id'])
command_dispatcher = CommandDispatcher('e' + task['id'], mq,
task['token'],
task['tenant_id'],
reporter)
workflows = []
for path in glob.glob("data/workflows/*.xml"):
log.debug('Loading XML {0}'.format(path))
@@ -106,10 +110,14 @@ class ConductorWorkflowService(service.Service):
except Exception as ex:
log.exception(ex)
break
command_dispatcher.close()
except reporting.ReportedException as e:
log.exception("Exception has occurred and was reported to API")
except Exception as e:
log.exception(e)
log.exception("Unexpected exception has occurred")
if reporter:
reporter.report_generic("Unexpected error has occurred",
e.message, 'error')
finally:
if 'token' in task:
del task['token']