<div dir="ltr"><div><div>Hi Renat,<br><br></div>for me just unclear the following syntacsis:<br>$.image_id<br>what is $ in this case? It will be more clear if we can replace $ to something - any instance with readable name, like global.image_id or context.image_id.<br>
looks like $ can be the different in different name spaces.<br><br></div>it will be unclear for new users and of course it will be easy when we have experience with the DSL.<br><br><br><br></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Wed, Feb 26, 2014 at 11:34 AM, Renat Akhmerov <span dir="ltr"><<a href="mailto:rakhmerov@mirantis.com" target="_blank">rakhmerov@mirantis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hi team,<div><br></div><div>I’m currently working on the first version of Data Flow and I would like to make sure we all clearly understand how to interpret “parameters" for tasks and actions when we declare them in Mistral DSL. I feel like I’m getting lost here a little bit. The problem is that we still don’t have a solid DSL spec since we keep changing our vision (especially after new members joined the team). But that may be fine, it’s life.</div>
<div><br></div><div>I also have a couple of suggestions that I’d like to discuss with you. Sorry if that seems verbose, I’ll try to be as concise as possible.</div><div><br></div><div>I took a couple of snippets from [1] and put them in here.</div>
<div><br></div><div><div style="background-color:rgb(240,240,240);font-family:'Trebuchet MS',sans-serif;font-size:15px"><pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px;font-family:'Bitstream Vera Sans Mono',monospace;font-size:13px">
<span style="color:rgb(96,160,176);font-style:italic"># Snippet 1.</span>
<span>Services</span><span>:</span>
  <span>Nova</span><span>:</span>
    <span>type</span><span>:</span> <span>REST_API</span>
    <span>parameters</span><span>:</span>
      <span>baseUrl</span><span>:</span> <span style="color:rgb(187,96,213)">$.novaURL</span>
    <span>actions</span><span>:</span>
      <span>createVM</span><span>:</span>
        <span>parameters</span><span>:</span>
          <span>url</span><span>:</span> <span>/servers/{$.vm_id}</span>
          <span>method</span><span>:</span> <span>POST</span>
        <span>output</span><span>:</span>
          <span>select</span><span>:</span> <span>$.<a href="http://server.id" target="_blank">server.id</a></span>
          <span>store-as</span><span>:</span> <span>vm_id</span>

<span style="color:rgb(96,160,176);font-style:italic"># Snippet 2.</span>
<span>Workflow</span><span>:</span>
  <span>tasks</span><span>:</span>
    <span>createVM</span><span>:</span>
      <span>action</span><span>:</span> <span>Nova:createVM</span>
      <span>on-success</span><span>:</span> <span>waitForIP</span>
      <span>on-error</span><span>:</span> <span>sendCreateVMError</span>
</pre></div><div><br></div></div><div>“$.” - handle to workflow execution storage (what we call ‘context’ now) where we keep workflow variables.</div><div><br></div><div>Let’s say our workflow input is JSON like this:</div>
<div><font face="Menlo">{</font></div><div><font face="Menlo">  “novaURL”: “<a href="http://localhost:123”" target="_blank">http://localhost:123”</a>,</font></div><div><font face="Menlo">  “image_id”: “123"</font></div>
<div><font face="Menlo">}</font></div><div><br></div><div style="font-size:16px"><b>Questions</b></div><div style="font-size:16px"><b><br></b></div><div>So the things that I don’t like or am not sure about:</div><div><br>
</div><div><b>1</b>. Task “createVM” needs to use “image_id” but it doesn’t have any information about it its declaration.</div><div>According to the current vision it should be like </div><div><pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px;font-family:'Bitstream Vera Sans Mono',monospace;font-size:13px">
    <span>createVM</span><span>:</span>
      <span>action</span><span>:</span> <span>Nova:createVM</span>
      <span>parameters</span><span>:</span>
        <span>image_id</span><span>:</span> <span>$.image_id</span>
</pre><pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px"><span><font face="Helvetica">And at runtime “image_id" should be resolved to “123” get passed to action and, in fact, be kind of the third parameter along with “url” and “method”. This is specifically interesting because on one hand we have different types of parameters: “url” and “method” for REST_API action define the nature of the action itself. But “image_id” on the other hand is a dynamic data coming eventually from user input.</font></span></pre>
<pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px"><span><font face="Helvetica"><b>So the question is: do we need to differentiate between these types of parameters explicitly and make a part of the specification?</b></font></span></pre>
<pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px"><span><font face="Helvetica">We also had a notion of “task-parameters” for action declarations which is supposed to be used to declare this second type of parameters (dynamic) but do we really need it? I guess if we clearly declare input and output at task level then actions should be able to use them according to their nature.</font></span></pre>
<pre style="margin-top:0px;margin-bottom:0px;padding:5px 0px"><font face="Helvetica"><b>2</b>. Action declaration “createVM” has section “response” which may not be ok in terms of level of abstraction. </font></pre></div>
<div><div>My current vision is that actions should not declare how we store the result (“output”) in execution. Ideally looking at tasks only should give us comprehensive understanding of how workflow data flows. So I would move “store-as” to task level.</div>
</div><div><br></div><div style="font-size:15px"><b>Suggestions</b></div><div><b><br></b></div><div><b>1</b>. Define “input” and “output” at task level like this:</div><div><br></div><div><font face="Menlo">     createVM:</font></div>
<div><font face="Menlo">       input:</font></div><div><font face="Menlo">         image_id: $.image_id</font></div><div><font face="Menlo">       output:</font><span style="font-family:Menlo;font-size:small"> vm_id</span></div>
<div><font face="Menlo"><br></font></div><div>Where “output: vm_id” is basically a replacement for “store-as: vm_id” at action level, i.e. it’s a hint to Mistral to store the output of this task under “vm_id” key in execution context. Again, the idea is to define task and action responsibilities more strictly:</div>
<div><ul><li><b>Task is a high-level workflow building block which defines workflow logical step and how it modifies workflow data. Task doesn’t contain technical details on how it’s implemented.</b></li><li><b>Action is an implementor of the workflow logical step defined by a task. Action defines specific algorithm of how task is implemented.</b></li>
</ul></div><div><br></div><div><b>2</b>. User “parameters” only for actions to specify their additional properties influencing their nature (like method for HTTP actions).</div><div><br></div><div><br></div><div>Please let me know your thoughts. We can make required adjustments right now.</div>
<div><br></div><div><br></div><div>[1] <a href="https://etherpad.openstack.org/p/mistral-poc" target="_blank">https://etherpad.openstack.org/p/mistral-poc</a></div><span class="HOEnZb"><font color="#888888"><div><br><div>

<div>Renat Akhmerov</div><div>@ Mirantis Inc.</div><div><br></div><br>

</div>
<br></div></font></span></div><br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><font color="#888888"><font color="#888888"><br></font></font><div style="font-family:arial;font-size:small">Timur,</div><div style="font-family:arial;font-size:small">
QA Lead</div><div style="font-family:arial;font-size:small">OpenStack Murano Project</div><div style="font-family:arial;font-size:small">Mirantis Inc</div></div>
</div>