Remove unnecessary evaluation of outbound context
* At some places we can't reuse evaluated context value. In case of big context sizes it saves lots of CPU cycles. * Added more profiler traces Change-Id: I07469efd15348c11ec9066928b962fb7a3bef686
This commit is contained in:
parent
a3c07e0d40
commit
4b6cca49b3
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from osprofiler import profiler
|
||||||
|
|
||||||
from mistral import config as cfg
|
from mistral import config as cfg
|
||||||
from mistral.db.v2 import api as db_api
|
from mistral.db.v2 import api as db_api
|
||||||
@ -129,6 +130,7 @@ class EngineServer(service_base.MistralService):
|
|||||||
**params
|
**params
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@profiler.trace('engine-server-on-action-complete')
|
||||||
def on_action_complete(self, rpc_ctx, action_ex_id, result_data,
|
def on_action_complete(self, rpc_ctx, action_ex_id, result_data,
|
||||||
result_error, wf_action):
|
result_error, wf_action):
|
||||||
"""Receives RPC calls to communicate action result to engine.
|
"""Receives RPC calls to communicate action result to engine.
|
||||||
|
@ -17,6 +17,7 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import oslo_messaging as messaging
|
import oslo_messaging as messaging
|
||||||
from oslo_messaging.rpc import client
|
from oslo_messaging.rpc import client
|
||||||
|
from osprofiler import profiler
|
||||||
from stevedore import driver
|
from stevedore import driver
|
||||||
|
|
||||||
from mistral import context as auth_ctx
|
from mistral import context as auth_ctx
|
||||||
@ -192,6 +193,7 @@ class EngineClient(base.Engine):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@wrap_messaging_exception
|
@wrap_messaging_exception
|
||||||
|
@profiler.trace('engine-client-on-action-complete')
|
||||||
def on_action_complete(self, action_ex_id, result, wf_action=False,
|
def on_action_complete(self, action_ex_id, result, wf_action=False,
|
||||||
async=False):
|
async=False):
|
||||||
"""Conveys action result to Mistral Engine.
|
"""Conveys action result to Mistral Engine.
|
||||||
|
@ -116,7 +116,7 @@ class DirectWorkflowController(base.WorkflowController):
|
|||||||
|
|
||||||
ctx = data_flow.evaluate_task_outbound_context(task_ex)
|
ctx = data_flow.evaluate_task_outbound_context(task_ex)
|
||||||
|
|
||||||
for t_n, params in self._find_next_tasks(task_ex):
|
for t_n, params in self._find_next_tasks(task_ex, ctx=ctx):
|
||||||
t_s = self.wf_spec.get_tasks()[t_n]
|
t_s = self.wf_spec.get_tasks()[t_n]
|
||||||
|
|
||||||
if not (t_s or t_n in commands.RESERVED_CMDS):
|
if not (t_s or t_n in commands.RESERVED_CMDS):
|
||||||
@ -228,12 +228,12 @@ class DirectWorkflowController(base.WorkflowController):
|
|||||||
def _find_next_task_names(self, task_ex):
|
def _find_next_task_names(self, task_ex):
|
||||||
return [t[0] for t in self._find_next_tasks(task_ex)]
|
return [t[0] for t in self._find_next_tasks(task_ex)]
|
||||||
|
|
||||||
def _find_next_tasks(self, task_ex):
|
def _find_next_tasks(self, task_ex, ctx=None):
|
||||||
t_state = task_ex.state
|
t_state = task_ex.state
|
||||||
t_name = task_ex.name
|
t_name = task_ex.name
|
||||||
|
|
||||||
ctx_view = data_flow.ContextView(
|
ctx_view = data_flow.ContextView(
|
||||||
data_flow.evaluate_task_outbound_context(task_ex),
|
ctx or data_flow.evaluate_task_outbound_context(task_ex),
|
||||||
self.wf_ex.context,
|
self.wf_ex.context,
|
||||||
self.wf_ex.input
|
self.wf_ex.input
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user