diff --git a/mistral/engine/default_engine.py b/mistral/engine/default_engine.py index 4a9123f21..8fbe03c5d 100644 --- a/mistral/engine/default_engine.py +++ b/mistral/engine/default_engine.py @@ -19,6 +19,8 @@ from oslo_config import cfg from oslo_log import log as logging from osprofiler import profiler +from mistral_lib import actions as ml_actions + from mistral.db import utils as db_utils from mistral.db.v2 import api as db_api from mistral.db.v2.sqlalchemy import models as db_models @@ -145,6 +147,12 @@ class DefaultEngine(base.Engine): with db_api.transaction(): if wf_action: action_ex = db_api.get_workflow_execution(action_ex_id) + + # If result is None it means that it's a normal subworkflow + # output and we just need to fetch it from the model. + # This is just an optimization to not send data over RPC + if result is None: + result = ml_actions.Result(data=action_ex.output) else: action_ex = db_api.get_action_execution(action_ex_id) diff --git a/mistral/engine/engine_server.py b/mistral/engine/engine_server.py index a76b2aadf..776469bb6 100644 --- a/mistral/engine/engine_server.py +++ b/mistral/engine/engine_server.py @@ -153,7 +153,7 @@ class EngineServer(service_base.MistralService): "Received RPC request 'on_action_complete'[action_ex_id=%s, " "result=%s]", action_ex_id, - result.cut_repr() + result.cut_repr() if result else '' ) return self.engine.on_action_complete(action_ex_id, result, wf_action) diff --git a/mistral/engine/workflows.py b/mistral/engine/workflows.py index f0402741b..bdd4efee7 100644 --- a/mistral/engine/workflows.py +++ b/mistral/engine/workflows.py @@ -551,7 +551,9 @@ class Workflow(object): def _send_result_to_parent_workflow(self): if self.wf_ex.state == states.SUCCESS: - result = ml_actions.Result(data=self.wf_ex.output) + # The result of the sub workflow is already saved + # so there's no need to send it over RPC. + result = None elif self.wf_ex.state == states.ERROR: err_msg = ( self.wf_ex.state_info or