Select, or pselect, that is the question -
Yeah, sometime application developer has almost Hamlet level questions. Murano engine can execute workflows in parallel mode which is actually a default behavior. If there are several application configured in a Murano environment all of them will deploy them-self in parallel if there is no special dependency handling in the workflow.
Another example is a cluster creation. When cluster has a list of instances which are all identical it makes sense to provision them simultaneously. Sometime there is a use case when you need to process instances one by one, for example in order to register slave on the master node.
There are two functions in Murano which handles both use cases.
List.select($.deploy()) will generate a sequence of executions of deploy method of each element in the list. It is equivalent to the for loop:
- For: inst
In: $.instances.take($.currentCount)
Do: - $inst.deploy()
In contrary, List.pselect($.deploy()) will initiate a parallel execution of deploy() method on each element of the list.
- $.instances.take($.currentCount).pselect($.deploy())
Please, note that "$" has overloaded usage here. If you use select or pselect then a "$" will represent the element of a list. If you want to call a method of the current class which will take list element as a parameter you will have to use full form of $this rather then $ like in example below:
- $.instances.take($.currentCount).pselect($this.configureKubeMinion($))
In this example current class ($this) method configureKubernetesMinion() will be called for each element of the list instances with the element passed as an argument of the method configureKubernetesMinion($)Enjoy !
No comments:
Post a Comment