Re: [openstack-dev] [Mistral] For-each

2014-12-21 Thread Renat Akhmerov

 On 20 Dec 2014, at 03:01, Dmitri Zimine dzim...@stackstorm.com wrote:
 
 Another observation on naming consistency - mistral uses dash, like 
 `for-each`. 
 Heat uses _underscores when naming YAML keys. 
 So does TOSCA standard. We should have thought about this earlier but it may 
 be not late to fix it while v2 spec is still forming. 

Dmitri,

We thought about it long ago. 

So my related comments/thoughts:
We didn’t find any strict requirements about using snake case in YAML
as well as in OpenStack
We also didn’t find any technical problems with using “dash case
One of the reasons to use “dash case” was a suggested style of naming workflow 
variables using snake case. So not to confuse workflow language keywords with 
workflow variables we consciously made this decision.
v2 is still forming but I’ve been totally against of introducing backwards 
incompatible changes into it since the beginning of October since we promised 
not to when we released 0.1 version. All the changes we’re now considering 
should be 100% backwards compatible with all existing syntax. Otherwise, it 
will be not easy to gain trusts from people who use it. Again, all changes must 
be additive within at least one major version of DSL. If we gather enough 
feedback that some of the things need to be changed in a non-backwards 
compatible way then we will probably create v3. Otherwise, why do we need 
versioning at all?

Renat Akhmerov
@ Mirantis Inc.

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-21 Thread Renat Akhmerov

 On 20 Dec 2014, at 06:54, Dmitri Zimine dzim...@stackstorm.com wrote:
 
 I appended some more ideas on making for-each loop more readable / less 
 confusing in the document. 
 
 It’s not rocking the boat (yet) - all the key agreements done that far, stay 
 so far. It’s refinements. 
 
 Please take a look, leave comments, +1 / -1 for various ideas, and leave your 
 ideas there, too. 
 
 https://docs.google.com/document/d/1iw0OgQcU0LV_i3Lnbax9NqAJ397zSYA3PMvl6F_uqm0/edit#heading=h.5hjdjqxsgfle
  
 https://docs.google.com/document/d/1iw0OgQcU0LV_i3Lnbax9NqAJ397zSYA3PMvl6F_uqm0/edit#heading=h.5hjdjqxsgfle

Dmitri, thanks. Looks like you guys have been really creative around this 
blueprint :)

I left my comments in the document. In essence, I would suggest we stop at the 
following syntax:


1. Short one-line syntax in case we need to iterate through one array.

task1:
for: my_item in $.my_array
action: my_action ….

2. Full syntax in case there are more than one array that we need to iterate 
through.

task1:
for:
my_item1: $.my_array1
my_item2: $.my_array2
...
action: my_action ….


Option 3

task1:
for:
- my_item1 in $.my_array1
- my_item2 in $.my_array2

also looks ok to me but it doesn’t seem a YAML way a little bit because in YAML 
we can express key-value pairs naturally like in #2. 


Actually, I don’t see any problems with supporting all three options.

As far as naming, let’s comment on each of the options we have now:
‘‘for-each’ - I’d be ok with it but seems like lots of people have been 
confused with it so far because their expectation were really different than 
the description we told them, so I’m ok to pick a different name.
“map” - I’m totally against it, first glance at “map” would make very little 
sense to me even though I understand where this option comes from. I’m pretty 
sure it will be even more confusing than “for-each”.
“with_items” -  Ansible style, it’s ok to me.
“for” - I think this is my favourite option so far. Semantically it may not be 
too different than “for-each” but it’s very concise and most general purpose 
languages have the same construct with similar semantics.

After all, my suggestion would be not to spend huge amount of time arguing on 
naming. Although it’s pretty important, it’s always subjective to a great 
extent.


Thanks

Renat Akhmerov
@ Mirantis Inc.

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-19 Thread Dmitri Zimine
Thanks Angus. 

One obvious thing is we either make it somewhat consistent, or name it 
differently. 
These looks similar, at least on the surface. I wonder if the feedback we’ve 
got so far (for-each is confusing because it brings wrong expectations) is 
applicable to Heat, too. 

Another observation on naming consistency - mistral uses dash, like `for-each`. 
Heat uses _underscores when naming YAML keys. 
So does TOSCA standard. We should have thought about this earlier but it may be 
not late to fix it while v2 spec is still forming. 

DZ. 


On Dec 18, 2014, at 9:07 PM, Angus Salkeld asalk...@mirantis.com wrote:

 On Mon, Dec 15, 2014 at 8:00 PM, Nikolay Makhotkin nmakhot...@mirantis.com 
 wrote:
 Hi,
 
 Here is the doc with suggestions on specification for for-each feature.
 
 You are free to comment and ask questions.
 
 https://docs.google.com/document/d/1iw0OgQcU0LV_i3Lnbax9NqAJ397zSYA3PMvl6F_uqm0/edit?usp=sharing
 
 
 
 Just as a drive by comment, there is a Heat spec for a for-each: 
 https://review.openstack.org/#/c/140849/
 (there hasn't been a lot of feedback for it yet tho')
 
 Nice to have these somewhat consistent.
 
 -Angus
  
 
 -- 
 Best Regards,Nikolay
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-18 Thread Dmitri Zimine
Based on the feedback so far, I updated the document and added some more 
details from the comments and discussions. 

We still think for-each as a keyword confuses people by setting up some 
behavior expectations (e.g., it will run sequentially, you can work with data 
inside the loop, you can ‘nest’ for-each loops - while it’s not a loop at all, 
just a way to run actions which are not accepting arrays of data, with arrays 
of data). 

But no better idea on the keyword just yet. 

DZ. 


On Dec 15, 2014, at 10:53 PM, Renat Akhmerov rakhme...@mirantis.com wrote:

 Thanks Nikolay,
 
 I also left my comments and tend to like Alt2 better than others. Agree with 
 Dmitri that “all-permutations” thing can be just a different construct in the 
 language and “concurrency” should be rather a policy than a property of 
 “for-each” because it doesn’t have any impact on workflow logic itself, it 
 only influence the way how engine runs a task. So again, policies are engine 
 capabilities, not workflow ones.
 
 One tricky question that’s still in the air is how to deal with publishing. I 
 mean in terms of requirements it’s pretty clear: we need to apply “publish” 
 once after all iterations and be able to access an array of iteration results 
 as $. But technically, it may be a problem to implement such behavior, need 
 to think about it more.
 
 Renat Akhmerov
 @ Mirantis Inc.
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-18 Thread Angus Salkeld
On Mon, Dec 15, 2014 at 8:00 PM, Nikolay Makhotkin nmakhot...@mirantis.com
wrote:

 Hi,

 Here is the doc with suggestions on specification for for-each feature.

 You are free to comment and ask questions.


 https://docs.google.com/document/d/1iw0OgQcU0LV_i3Lnbax9NqAJ397zSYA3PMvl6F_uqm0/edit?usp=sharing



Just as a drive by comment, there is a Heat spec for a for-each:
https://review.openstack.org/#/c/140849/
(there hasn't been a lot of feedback for it yet tho')

Nice to have these somewhat consistent.

-Angus



 --
 Best Regards,
 Nikolay

 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-15 Thread Dmitri Zimine
I had a short user feedback sessions with Patrick and James, the short summary 
is:

1) simplify the syntax to optimize for the most common use case
2) 'concurrency' is the best word - but bring it out of for-each to task level, 
or task/policies 
3) all-permutation - relatively rare case, either implement as a different 
construct - like ‘for-every’, or use workaround.

Another feedback is  for-each as a term is confusing: people expect a different 
behavior (e.g., run sequentially, modify individual elements)
while it is effectively a ‘map’ function. No good suggestion on the better name 
yet. Keep on looking.

The details are added into the document.

DZ. 

On Dec 15, 2014, at 2:00 AM, Nikolay Makhotkin nmakhot...@mirantis.com wrote:

 Hi,
 
 Here is the doc with suggestions on specification for for-each feature.
 
 You are free to comment and ask questions.
 
 https://docs.google.com/document/d/1iw0OgQcU0LV_i3Lnbax9NqAJ397zSYA3PMvl6F_uqm0/edit?usp=sharing
 
 
 
 -- 
 Best Regards,
 Nikolay

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [Mistral] For-each

2014-12-15 Thread Renat Akhmerov
Thanks Nikolay,

I also left my comments and tend to like Alt2 better than others. Agree with 
Dmitri that “all-permutations” thing can be just a different construct in the 
language and “concurrency” should be rather a policy than a property of 
“for-each” because it doesn’t have any impact on workflow logic itself, it only 
influence the way how engine runs a task. So again, policies are engine 
capabilities, not workflow ones.

One tricky question that’s still in the air is how to deal with publishing. I 
mean in terms of requirements it’s pretty clear: we need to apply “publish” 
once after all iterations and be able to access an array of iteration results 
as $. But technically, it may be a problem to implement such behavior, need to 
think about it more.

Renat Akhmerov
@ Mirantis Inc.
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev