Skip to content
Alex O. Karasulu edited this page Jan 19, 2018 · 1 revision

Batch

batch -json <json command> - batch commands execution

Example:

subutai batch -json '[{"action": "clone", "args": ["master", "container1"]}, {"action": "clone", "args": ["master", "container2"]}]'

Description:

The batch binding provides a mechanism to perform several Subutai commands in the container in batch, passed in a single JSON message. Initially, the purpose of this command was internal for SS <-> Agent communication, yet it may be invoked manually from the CLI. The response from a batch command returns a JSON array with each element representing the results (response) from each command (request) in the batch: the positions of responses correlate with the request position in the array:

requesting localhost system information and IP address:

subutai batch -json '[{"action": "info", "args": ["system", "localhost"]}, {"action": "info", "args": ["ipaddr"]}]'

first element in response array is system information, second - IP address:

[{
 "output": "{
     "host":"localhost",  
     "CPU":{
         "model":" Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz",  
         "coreCount":2,  
         "idle":97.79661016949153,  
         "frequency":" 1995.380"  
  },
     "Disk":{  
         "total":107374182400,  
         "used":4024963072
  },  
     "RAM":{  
         "free":118759424,  
         "total":2098094080  
  }}",  
 "exitcode": "0"
}, {  
 "output": "192.168.0.101",  
 "exitcode": "0"  
}]`