Activity log for bug #1690158

Date Who What changed Old value New value Message
2017-05-11 14:25:14 Bob Haddleton bug added bug
2017-05-11 14:25:31 Bob Haddleton mistral: assignee Bob Haddleton (bob-haddleton)
2017-05-11 14:25:37 Bob Haddleton mistral: status New In Progress
2017-05-15 00:35:09 Bob Haddleton description Ad-hoc actions cannot reference env() in YAQL and Jinja expressions. This is a placeholder - I will add an example with the resulting error Ad-hoc actions cannot reference env() in YAQL and Jinja expressions. The AdHocAction methods _prepare_input() and _prepare_output() call expr.evaluate_recursively() but they don't have access to the environment data that was passed in to the workflow, since the Action does not have access to the wf_ex.context. Sample workbook: version: "2.0" name: TestEnv actions: print_env_yaql_msg: input: - message: bar base: std.echo base-input: output: "<% $.message %>: <% env().foo %>" print_env_jinja_msg: input: - message: bar base: std.echo base-input: output: '{{ _.message }}: {{ env().foo }}' workflows: dump_environment_broken: type: direct input: - dummy: null tasks: print_env_yaql_bad: action: print_env_yaql_msg print_env_jinja_bad: action: print_env_jinja_msg Executing this workflow produces the following exception: mistral execution-create TestEnv.dump_environment_broken '{"dummy": "foobar"}' '{"env": {"foo": "bar"}}' +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ID | 4a2ddd7c-409d-4162-902a-f17f6f3505a2 | | Workflow ID | f734a15b-c471-4cfc-b0fb-7623a89f269f | | Workflow name | TestEnv.dump_environment_broken | | Description | | | Task Execution ID | <none> | | State | ERROR | | State info | Failed to run task [error=Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}], wf=WorkflowExecution | | | {'state_info': None, 'accepted': False, 'output': {}, 'name': u'TestEnv.dump_environment_broken', 'workflow_name': u'TestEnv.dump_environment_broken', 'state': | | | 'RUNNING', 'created_at': '2017-05-15 00:27:17', 'runtime_context': {'index': 0}, 'updated_at': '2017-05-15 00:27:17', 'spec': {u'input': [{u'dummy': None}], u'tasks': | | | {u'print_env_jinja_bad': {u'action': u'print_env_jinja_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_jinja_bad'}, u'print_env_yaql_bad': {u'action': | | | u'print_env_yaql_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_yaql_bad'}}, u'type': u'direct', u'name': u'dump_environment_broken', u'version': | | | u'2.0'}, 'workflow_id': u'f734a15b-c471-4cfc-b0fb-7623a89f269f', 'params': {u'env': {u'foo': u'bar'}}, 'context': {'__env': {u'foo': u'bar'}, '__execution': {'id': '4a2ddd7c- | | | 409d-4162-902a-f17f6f3505a2'}}, 'input': {u'dummy': u'foobar'}, 'scope': 'private', 'project_id': '<default-project>', 'task_execution_id': None, 'id': '4a2ddd7c-409d-4162 | | | -902a-f17f6f3505a2', 'description': u''}, task=print_env_yaql_bad]: | | | Traceback (most recent call last): | | | File "/root/git/mistral/mistral/engine/task_handler.py", line 58, in run_task | | | task.run() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 269, in run | | | self._run_new() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 293, in _run_new | | | self._schedule_actions() | | | File "/root/git/mistral/mistral/engine/tasks.py", line 347, in _schedule_actions | | | action.validate_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 352, in validate_input | | | self._prepare_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 364, in _prepare_input | | | base_input_dict | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 96, in evaluate_recursively | | | data[key] = _evaluate_item(data[key], context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 79, in _evaluate_item | | | return evaluate(item, context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 71, in evaluate | | | return evaluator.evaluate(expression, context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 110, in evaluate | | | cls).evaluate(trim_expr, data_context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 61, in evaluate | | | ", data=%s]" % (expression, str(e), data_context) | | | YaqlEvaluationException: Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}] | | | | | Created at | 2017-05-15 00:27:17 | | Updated at | 2017-05-15 00:27:17 | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2017-05-15 02:04:50 Bob Haddleton description Ad-hoc actions cannot reference env() in YAQL and Jinja expressions. The AdHocAction methods _prepare_input() and _prepare_output() call expr.evaluate_recursively() but they don't have access to the environment data that was passed in to the workflow, since the Action does not have access to the wf_ex.context. Sample workbook: version: "2.0" name: TestEnv actions: print_env_yaql_msg: input: - message: bar base: std.echo base-input: output: "<% $.message %>: <% env().foo %>" print_env_jinja_msg: input: - message: bar base: std.echo base-input: output: '{{ _.message }}: {{ env().foo }}' workflows: dump_environment_broken: type: direct input: - dummy: null tasks: print_env_yaql_bad: action: print_env_yaql_msg print_env_jinja_bad: action: print_env_jinja_msg Executing this workflow produces the following exception: mistral execution-create TestEnv.dump_environment_broken '{"dummy": "foobar"}' '{"env": {"foo": "bar"}}' +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ID | 4a2ddd7c-409d-4162-902a-f17f6f3505a2 | | Workflow ID | f734a15b-c471-4cfc-b0fb-7623a89f269f | | Workflow name | TestEnv.dump_environment_broken | | Description | | | Task Execution ID | <none> | | State | ERROR | | State info | Failed to run task [error=Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}], wf=WorkflowExecution | | | {'state_info': None, 'accepted': False, 'output': {}, 'name': u'TestEnv.dump_environment_broken', 'workflow_name': u'TestEnv.dump_environment_broken', 'state': | | | 'RUNNING', 'created_at': '2017-05-15 00:27:17', 'runtime_context': {'index': 0}, 'updated_at': '2017-05-15 00:27:17', 'spec': {u'input': [{u'dummy': None}], u'tasks': | | | {u'print_env_jinja_bad': {u'action': u'print_env_jinja_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_jinja_bad'}, u'print_env_yaql_bad': {u'action': | | | u'print_env_yaql_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_yaql_bad'}}, u'type': u'direct', u'name': u'dump_environment_broken', u'version': | | | u'2.0'}, 'workflow_id': u'f734a15b-c471-4cfc-b0fb-7623a89f269f', 'params': {u'env': {u'foo': u'bar'}}, 'context': {'__env': {u'foo': u'bar'}, '__execution': {'id': '4a2ddd7c- | | | 409d-4162-902a-f17f6f3505a2'}}, 'input': {u'dummy': u'foobar'}, 'scope': 'private', 'project_id': '<default-project>', 'task_execution_id': None, 'id': '4a2ddd7c-409d-4162 | | | -902a-f17f6f3505a2', 'description': u''}, task=print_env_yaql_bad]: | | | Traceback (most recent call last): | | | File "/root/git/mistral/mistral/engine/task_handler.py", line 58, in run_task | | | task.run() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 269, in run | | | self._run_new() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 293, in _run_new | | | self._schedule_actions() | | | File "/root/git/mistral/mistral/engine/tasks.py", line 347, in _schedule_actions | | | action.validate_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 352, in validate_input | | | self._prepare_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 364, in _prepare_input | | | base_input_dict | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 96, in evaluate_recursively | | | data[key] = _evaluate_item(data[key], context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 79, in _evaluate_item | | | return evaluate(item, context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 71, in evaluate | | | return evaluator.evaluate(expression, context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 110, in evaluate | | | cls).evaluate(trim_expr, data_context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 61, in evaluate | | | ", data=%s]" % (expression, str(e), data_context) | | | YaqlEvaluationException: Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}] | | | | | Created at | 2017-05-15 00:27:17 | | Updated at | 2017-05-15 00:27:17 | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Ad-hoc actions cannot reference env() in YAQL and Jinja expressions. The AdHocAction methods _prepare_input() and _prepare_output() call expr.evaluate_recursively() but they don't have access to the environment data that was passed in to the workflow, since the Action does not have access to the wf_ex.context. Sample workbook: version: "2.0" name: TestEnv actions:   print_env_yaql_msg:     input:       - message: bar     base: std.echo     base-input:       output: "<% $.message %>: <% env().foo %>"   print_env_jinja_msg:     input:       - message: bar     base: std.echo     base-input:       output: '{{ env().foo }}' workflows:   dump_environment_broken:     type: direct     input:       - dummy: null     tasks:       print_env_yaql_bad:         action: print_env_yaql_msg       print_env_jinja_bad:         action: print_env_jinja_msg Executing this workflow produces the following exception: mistral execution-create TestEnv.dump_environment_broken '{"dummy": "foobar"}' '{"env": {"foo": "bar"}}' +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ID | 4a2ddd7c-409d-4162-902a-f17f6f3505a2 | | Workflow ID | f734a15b-c471-4cfc-b0fb-7623a89f269f | | Workflow name | TestEnv.dump_environment_broken | | Description | | | Task Execution ID | <none> | | State | ERROR | | State info | Failed to run task [error=Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}], wf=WorkflowExecution | | | {'state_info': None, 'accepted': False, 'output': {}, 'name': u'TestEnv.dump_environment_broken', 'workflow_name': u'TestEnv.dump_environment_broken', 'state': | | | 'RUNNING', 'created_at': '2017-05-15 00:27:17', 'runtime_context': {'index': 0}, 'updated_at': '2017-05-15 00:27:17', 'spec': {u'input': [{u'dummy': None}], u'tasks': | | | {u'print_env_jinja_bad': {u'action': u'print_env_jinja_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_jinja_bad'}, u'print_env_yaql_bad': {u'action': | | | u'print_env_yaql_msg', u'version': '2.0', u'type': u'direct', u'name': u'print_env_yaql_bad'}}, u'type': u'direct', u'name': u'dump_environment_broken', u'version': | | | u'2.0'}, 'workflow_id': u'f734a15b-c471-4cfc-b0fb-7623a89f269f', 'params': {u'env': {u'foo': u'bar'}}, 'context': {'__env': {u'foo': u'bar'}, '__execution': {'id': '4a2ddd7c- | | | 409d-4162-902a-f17f6f3505a2'}}, 'input': {u'dummy': u'foobar'}, 'scope': 'private', 'project_id': '<default-project>', 'task_execution_id': None, 'id': '4a2ddd7c-409d-4162 | | | -902a-f17f6f3505a2', 'description': u''}, task=print_env_yaql_bad]: | | | Traceback (most recent call last): | | | File "/root/git/mistral/mistral/engine/task_handler.py", line 58, in run_task | | | task.run() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 269, in run | | | self._run_new() | | | File "/root/git/mistral/.tox/py27/lib/python2.7/site-packages/osprofiler/profiler.py", line 153, in wrapper | | | return f(*args, **kwargs) | | | File "/root/git/mistral/mistral/engine/tasks.py", line 293, in _run_new | | | self._schedule_actions() | | | File "/root/git/mistral/mistral/engine/tasks.py", line 347, in _schedule_actions | | | action.validate_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 352, in validate_input | | | self._prepare_input(input_dict) | | | File "/root/git/mistral/mistral/engine/actions.py", line 364, in _prepare_input | | | base_input_dict | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 96, in evaluate_recursively | | | data[key] = _evaluate_item(data[key], context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 79, in _evaluate_item | | | return evaluate(item, context) | | | File "/root/git/mistral/mistral/expressions/__init__.py", line 71, in evaluate | | | return evaluator.evaluate(expression, context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 110, in evaluate | | | cls).evaluate(trim_expr, data_context) | | | File "/root/git/mistral/mistral/expressions/yaql_expression.py", line 61, in evaluate | | | ", data=%s]" % (expression, str(e), data_context) | | | YaqlEvaluationException: Can not evaluate YAQL expression [expression=env().foo, error=Unknown function "#property#foo", data={u'message': u'foo'}] | | | | | Created at | 2017-05-15 00:27:17 | | Updated at | 2017-05-15 00:27:17 | +-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2017-05-18 04:09:16 Renat Akhmerov mistral: milestone pike-2
2017-05-18 04:09:20 Renat Akhmerov mistral: importance Undecided Medium
2017-05-19 16:03:44 OpenStack Infra mistral: status In Progress Fix Released