Recursive generation of YAQL objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mistral |
Triaged
|
Medium
|
Unassigned |
Bug Description
As a workflow/action designer, I should be able to define variables that I can re-use in other expressions in the same task.
For instance, with "publish":
```yaml
version: 2.0
my_workflow:
tasks:
start:
action: std.noop
publish:
```
This task should publish:
```yaml
my_first_variable: 1
child_variable: 2
gd_child_variable: 4
```
This can be done using a dependency graph/topological sort. During the dependency graph generation, cycles can be detected and reported as an error. The variables have to be generated according the result of the topological sort.
Changed in mistral: | |
status: | New → Triaged |
importance: | Undecided → Medium |
So, i've run into this same issue myself.
From my investigation i believe it's caused by mistral not updating the context used for expression evaluation after each publish statement is evaluated. Instead the context is created at the beginning of the publish block and then merged into the global context upon completion of the task.
The task begins publishing variables here: /github. com/openstack/ mistral/ blob/master/ mistral/ engine/ tasks.py# L164
https:/
Then a context is created and evaluation begins: /github. com/openstack/ mistral/ blob/master/ mistral/ workflow/ data_flow. py#L187- L217
https:/
Evaluation is triggered by this line: /github. com/openstack/ mistral/ blob/master/ mistral/ workflow/ data_flow. py#L209
https:/
Evaluation is done by the following: /github. com/openstack/ mistral/ blob/master/ mistral/ expressions/ __init_ _.py#L88- L103
https:/
It's in this final code snippet where you can see that the evaluation simply creates a new data structure (dict) and does not merge the result back into the current context being used for evaluation.
This is my first time looking at the code base so i may be off in left field.
Any feedback is appreciated.