iterator - executes one or more instances of a set of actions

 1. Description

The action http://www.n3phele.com/iterator executes one or more instances of a set of actions. The actions run in parallel or serially, based on their defined dependencies. The set of instances are dependent on the iterator action, other actions in the command and each each other, and terminated by a http://www.n3phele.com/join action.. The iterator will create "n" instances of the actions in the chain, where "n" can either be a constant or expression. One use of the iterator is to perform a command execution action on each of a set of VMs.
 
The fields of the action are:
 
 name  Used to name the iterator. The name must start with an alphabetic or underscore character, and be followed by one or more alphanumeric or underscore characters. Names cannot contain spaces.
 description  A description of the iterator purpose
 workloadKey  An unique identifier for the workload
 action  http://www.n3phele.com/iterator
 inputParameters  A list of input parameters describing the nature of the iterator. See 2. Input Parameters for details.
 

2. Input Parameters

The input parameters specify the characteristics of the iterator, including size and a number of virtual machine related parameters that are useful to the execution chain, as follows:
 
 
 parameter name  type  definition
 dependency list list of dependencies for the action. defaults to an empty list
 n  Long  number of instances to create. Default 1.
 agentUser  secret  username for authenticated access to the vm agent.
 agentPassword  agentPassword  password for authenticated access to the vm agent. defaults to a secret.
 agentUrls  list   url of all agents created
 vmURIs     list  List of URIs for VM(s) created
 publicIpAddressLis  list  list of public IP addresses of the created VM(s)
 privateIpAddressList  list  private IP addresses of the created VMs

3. Output Parameters

The output parameters specify characteristics of the interator, as follows:
 
 parameter name  type  definition
complete Boolean action chain instantiation complete.
 

4. Iterator action processing and parameters

The iterator scans all its dependent actions looking for actions with a name that ends in "-0", and is generally of the form basename-0, where basename is a valid action name. These actions are replicated n times, and in each instance an input parameter type Long named "i" is created, and set to the instance number from 0 to n-1. The name of the replicated instance is altered, replacing the suffix -0 to form the name basename-i. The join action which shares the basename of the iterated actions is updated so that it is dependent on the n instances.
Figure 1. Example 
 

  {
    "name" : "slaveIterator",
    "description" : "DenoiseCluster slave setup iterator",
    "workloadKey" : "slaveIterator",
    "action" : "http://www.n3phele.com/iterator",
    "inputParameters" : [{
        "name" : "agentUrls",
        "type" : "List",
        "value" : "$<DenoiseCluster.agentUrls>"
    },
    {
        "name" : "agentUser",
        "type" : "String",
        "value" : "$<DenoiseCluster.agentUser>"
    },
    {
        "name" : "agentPassword",
        "type" : "String",
        "value" : "$<DenoiseCluster.agentPassword>"
    },
    
        "name" : "n",
        "type" : "Long",
        "value" : "$<n>"
    }]
},
{
    "name" : "setupSlave-0",
    "description" : "run cluster slave setup process",
    "workloadKey" : "run_cluster_assembly_process",
    "action" : "http://www.n3phele.com/executecommand",
    "inputParameters" : [{
        "name" : "command",
        "description" : "Shell command",
        "type" : "String",
        "value" : "\"echo '\"+regex($<setupMaster.stdout>, \".*(ssh-rsa .*cluster).*\", 1)+\"' >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys; \""
    
},
    {
        "name" : "agentBaseUrl",
        "type" : "String",
        "value" : "$<slaveIterator.agentUrls>[$<i>]"
    },
    {
        "name" : "agentUser",
        "type" : "String",
        "value" : "
$<slaveIterator.agentUser>"
    },
    {
        "name" : "agentPassword",
        "type" : "String",
        "value" : "
$<slaveIterator.agentPassword>"
    }]
},
{ "name" : "setupSlave",
"    description" : "run cluster slave setup process join",
    "workloadKey" : "run_cluster_assembly_process_join",
    "action" : "http://www.n3phele.com/join"
},

 
 
 
 
 
 
 
 
 
 
 
 
 
Comments