From f172e5da24b306b81ce617d4aee58470d33f4513 Mon Sep 17 00:00:00 2001 From: apetrich Date: Mon, 6 May 2019 13:39:48 +0200 Subject: [PATCH] Adding root_execution_id to the jinja executor function This makes getting a root_execution_id possible without having to go through filtering and querying the executions search. Change-Id: Ia6c954e688589f69a7463f1b8e02244d029e8b7a --- mistral/tests/unit/expressions/test_jinja_expression.py | 8 +++++--- mistral/utils/expression_utils.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mistral/tests/unit/expressions/test_jinja_expression.py b/mistral/tests/unit/expressions/test_jinja_expression.py index f48c451b8..340bb1e3a 100644 --- a/mistral/tests/unit/expressions/test_jinja_expression.py +++ b/mistral/tests/unit/expressions/test_jinja_expression.py @@ -216,7 +216,7 @@ class JinjaEvaluatorTest(base.BaseTest): 'type': task.type, 'workflow_execution_id': task.workflow_execution_id, 'created_at': task.created_at.isoformat(' '), - 'updated_at': task.updated_at.isoformat(' ') + 'updated_at': task.updated_at.isoformat(' '), }, result) @mock.patch('mistral.db.v2.api.get_task_executions') @@ -320,7 +320,8 @@ class JinjaEvaluatorTest(base.BaseTest): 'input': wf_ex.input, 'params': wf_ex.params, 'created_at': wf_ex.created_at.isoformat(' '), - 'updated_at': wf_ex.updated_at.isoformat(' ') + 'updated_at': wf_ex.updated_at.isoformat(' '), + 'root_execution_id': wf_ex.root_execution_id }, result) def test_executions(self): @@ -458,7 +459,8 @@ class JinjaEvaluatorTest(base.BaseTest): 'input': wf_ex.input, 'params': wf_ex.params, 'created_at': wf_ex.created_at.isoformat(' '), - 'updated_at': wf_ex.updated_at.isoformat(' ') + 'updated_at': wf_ex.updated_at.isoformat(' '), + 'root_execution_id': wf_ex.root_execution_id }, result) diff --git a/mistral/utils/expression_utils.py b/mistral/utils/expression_utils.py index 024f34c6b..7d0d8b454 100644 --- a/mistral/utils/expression_utils.py +++ b/mistral/utils/expression_utils.py @@ -181,7 +181,8 @@ def execution_(context): 'input': wf_ex.input, 'params': wf_ex.params, 'created_at': wf_ex.created_at.isoformat(' '), - 'updated_at': wf_ex.updated_at.isoformat(' ') + 'updated_at': wf_ex.updated_at.isoformat(' '), + 'root_execution_id': wf_ex.root_execution_id }