Hi all,
We’ve created another etherpad https://etherpad.openstack.org/p/mistral-poc
where we proposed additional Mistral features that are going to be reflected in
DSL. One of the most important things is Data Flow, it’s main idea, how it
matches to the initial workflow model and how it affects DSL. For convenience
I’ll provide the snippet from this etherpad about Data Flow in this email.
"
Data Flow
When we start a workflow we optionally set initial state of workflow execution
context (basically, just object model representable in JSON format).
Expose workflow execution context object accessible as "$." in YAQL notation in
DSL.
A task optionally has a YAQL expression to select needed data from workflow
execution context. Selected data is considered task input and it gets
translated to parameters of corresponding REST action (http request body in
case of POST), AMQP action (as a JSON object) etc.
A task produces a result, the result gets merged into the context and the
context copy gets passed to the next task.
Context object is immutable and each task gets a copy of it to avoid needs to
use locking techniques. It gets passed to the next task with the task itself
via a message queue.
DSL snippet
Workflow:
tasks:
task1:
input: $.people.[$.age > 30].address # Input selector expression
in YAQL notation that is used to select data needed for task1 from workflow
execution context
action: MyRest:action1
Services:
MyRest:
type: REST_API
parameters:
baseUrl: http://localhost:8988/my_service
actions:
action1:
parameters:
url: /action1
method: POST
Let's say the initial workflow execution context is as follows:
{
"people": [
{
"first_name": "John",
"last_name": "Doe",
"age": 32,
"address": {
"street": "25 Broadway Avenue",
"city": "Woodstock"
}
},
{
"first_name": "Jane",
"last_name": "Doe",
"age": 28,
"address": {
"street": "101 Jackson Street",
"city": "Gamilton"
}
}
]}
Then input selector "$.people.[$.age > 30].address.city" will evaluate to:
{
"street": "25 Broadway Avenue",
"city": "Woodstock"
}
And corresponding HTTP request will be:
http POST http://localhost:8988/my_service/action1
{
"street": "25 Broadway Avenue",
"city": "Woodstock"
}
In case of HTTP GET it will look like:
http GET
http://localhost:8988/my_service/action1?street=25+Broadway+Avenue&city=Woodstock
“
If you have any concerns or new ideas on how to improve what we’re proposing
please feel free to share with us.
Thanks.
Renat Akhmerov
@ Mirantis Inc.
_______________________________________________
OpenStack-dev mailing list
[email protected]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev