Avoid recreating notify details for each dispatch iteration

We can just create the notification details once and reuse
it for each iteration, instead of recreating it for each
iteration; saves some resources...

Change-Id: Ie8ad61647afe2eef813af87a915710cf91de8e46
This commit is contained in:
Joshua Harlow
2015-11-16 15:45:12 -08:00
committed by Min Pae
parent cc27e44751
commit ff0cb5d5b0

View File

@@ -183,22 +183,19 @@ class ExecutorConductor(base.Conductor):
stack.enter_context(listener) stack.enter_context(listener)
self._log.debug("Dispatching engine for job '%s'", job) self._log.debug("Dispatching engine for job '%s'", job)
consume = True consume = True
details = {
'job': job,
'engine': engine,
'conductor': self,
}
try: try:
for stage_func, event_name in [(engine.compile, 'compilation'), for stage_func, event_name in [(engine.compile, 'compilation'),
(engine.prepare, 'preparation'), (engine.prepare, 'preparation'),
(engine.validate, 'validation'), (engine.validate, 'validation'),
(engine.run, 'running')]: (engine.run, 'running')]:
self._notifier.notify("%s_start" % event_name, { self._notifier.notify("%s_start" % event_name, details)
'job': job,
'engine': engine,
'conductor': self,
})
stage_func() stage_func()
self._notifier.notify("%s_end" % event_name, { self._notifier.notify("%s_end" % event_name, details)
'job': job,
'engine': engine,
'conductor': self,
})
except excp.WrappedFailure as e: except excp.WrappedFailure as e:
if all((f.check(*self.NO_CONSUME_EXCEPTIONS) for f in e)): if all((f.check(*self.NO_CONSUME_EXCEPTIONS) for f in e)):
consume = False consume = False