Takes a list of InstanceGroups, or a single InstanceGroup. Returns
        a comparable dict for use in making a RunJobFlow or AddInstanceGroups
        request.
353466
def _build_instance_group_list_args(self, instance_groups):
        
        if type(instance_groups) != types.ListType:
            instance_groups = [instance_groups]

        params = {}
        for i, instance_group in enumerate(instance_groups):
            ig_dict = self._build_instance_group_args(instance_group)
            for key, value in ig_dict.iteritems():
                params['InstanceGroups.member.%d.%s' % (i+1, key)] = value
        return params
1059254
def processor_groups(mesh_shape, group_dims):
  
  group_numbers = [
      pnum_to_group(mesh_shape, group_dims, pnum)
      for pnum in xrange(mesh_shape.size)]
  ret = []
  for pnum, g in enumerate(group_numbers):
    while len(ret) <= g:
      ret.append([])
    ret[g].append(pnum)
  return ret
1135527
def to_list(self):
        
        ret = []
        for instance in self.instances:
            ret.append(instance.to_dict())
        return ret
1364705
public java.util.List<String> getInstanceGroupTypes() {
        if (instanceGroupTypes == null) {
            instanceGroupTypes = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return instanceGroupTypes;
    }
509975
def _build_instance_group_args(self, instance_group):
        
        params = {
            'InstanceCount' : instance_group.num_instances,
            'InstanceRole' : instance_group.role,
            'InstanceType' : instance_group.type,
            'Name' : instance_group.name,
            'Market' : instance_group.market
        }
        if instance_group.market == 'SPOT':
            params['BidPrice'] = instance_group.bidprice
        return params
889507
def get_instances(self):
        
        return [c.get('instance') for c in self.runtime._nodes.values()
                if c.get('instance')]
1225271
def list_instance_templates(self):
        
        response = self.get_proto(path='/instance-templates')
        message = rest_pb2.ListInstanceTemplatesResponse()
        message.ParseFromString(response.content)
        templates = getattr(message, 'template')
        return iter([InstanceTemplate(template) for template in templates])
341803
def get_instances(device_owners=None, vnic_type=None, instance_id=None):
    """"""
    session = db.get_reader_session()
    with session.begin():
        port_model = models_v2.Port
        binding_model = ml2_models.PortBinding
        instances = (session
                     .query(port_model,
                            binding_model)
                     .outerjoin(
                         binding_model,
                         port_model.id == binding_model.port_id)
                     .distinct(port_model.device_id)
                     .group_by(port_model.device_id)
                     .filter_unnecessary_ports(device_owners, vnic_type))
        if instance_id:
            instances = instances.filter(port_model.device_id == instance_id)
    return instances.all()
479617
def get_instances(self):
        
        services = []
        for resource in self._get_instances():
            services.append(resource['entity']['name'])

        return services
231876
public ModifyInstanceGroupsRequest withInstanceGroup(ModifyInstanceGroupConfig instanceGroup) {
        if (this.instanceGroups == null) {
            this.instanceGroups = new ArrayList<ModifyInstanceGroupConfig>();
        }
        this.instanceGroups.add(instanceGroup);
        return this;
    }
479709
def get_os_instances():
        
        LOGGER.debug("OSInstanceService.get_os_instances")
        args = {'http_operation': 'GET', 'operation_path': ''}
        response = OSInstanceService.requester.call(args)
        ret = None
        if response.rc == 0:
            ret = []
            for osInstance in response.response_content['osInstances']:
                ret.append(OSInstance.json_2_os_instance(osInstance))
        elif response.rc != 404:
            err_msg = 'OSInstanceService.get_os_instances - Problem while getting os instances. ' \
                      '. Reason: ' + str(response.response_content) + '-' + str(response.error_message) + \
                      " (" + str(response.rc) + ")"
            LOGGER.warning(err_msg)
        return ret
131544
def get_groups(self):
        
        response = self.client.list_groups(UserPoolId=self.user_pool_id)
        return [self.get_group_obj(group_data)
                for group_data in response.get('Groups')]
944408
def do_printInstances(self,args):
        """"""
        parser = CommandArgumentParser("printInstances")
        parser.add_argument(dest='filters',nargs='*',default=["*"],help='Filter instances');
        parser.add_argument('-a','--addresses',action='store_true',dest='addresses',help='list all ip addresses');
        parser.add_argument('-t','--tags',action='store_true',dest='tags',help='list all instance tags');
        parser.add_argument('-d','--allDetails',action='store_true',dest='details',help='print all instance details');
        parser.add_argument('-r','--refresh',action='store_true',dest='refresh',help='refresh');
        parser.add_argument('-z','--zones',dest='availabilityZones',nargs='+',help='Only include specified availability zones');
        args = vars(parser.parse_args(args))
        
        client = AwsConnectionFactory.getEc2Client()

        filters = args['filters']
        addresses = args['addresses']
        tags = args['tags']
        details = args['details']
        availabilityZones = args['availabilityZones']
        needDescription = addresses or tags or details

        if args['refresh']:
            self.scalingGroupDescription = self.client.describe_auto_scaling_groups(AutoScalingGroupNames=[self.scalingGroup])
        
        # print "AutoScaling Group:{}".format(self.scalingGroup)
        print "=== Instances ==="
        instances = self.scalingGroupDescription['AutoScalingGroups'][0]['Instances']

        instances = filter( lambda x: fnmatches(x['InstanceId'],filters),instances)
        if availabilityZones:
            instances = filter( lambda x: fnmatches(x['AvailabilityZone'],availabilityZones),instances)
        
        index = 0
        for instance in instances:
            instance['index'] = index
            print "* {0:3d} {1} {2} {3}".format(index,instance['HealthStatus'],instance['AvailabilityZone'],instance['InstanceId'])
            description = None
            if needDescription:
                description = client.describe_instances(InstanceIds=[instance['InstanceId']])
            if addresses:
                networkInterfaces = description['Reservations'][0]['Instances'][0]['NetworkInterfaces']
                number = 0
                print "      Network Interfaces:"
                for interface in networkInterfaces:
                    print "         * {0:3d} {1}".format(number, interface['PrivateIpAddress'])
                    number +=1
            if tags:
                tags = description['Reservations'][0]['Instances'][0]['Tags']
                print "      Tags:"
                for tag in tags:
                    print "        * {0} {1}".format(tag['Key'],tag['Value'])
            if details:
                pprint(description)
                
            index += 1
421735
def group_list(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.list_groups(**kwargs)
433407
def reboot_instances(self, instance_ids=None):
        
        params = {}
        if instance_ids:
            self.build_list_params(params, instance_ids, 'InstanceId')
        return self.get_status('RebootInstances', params)
980479
def create_generic_instances(self, instances):
        
        generic_instances = []

        for instance in instances:
            istio_mesh_instance = self._create_istio_mesh_instance(instance)
            process_mixer_instance = self._create_process_mixer_instance(instance)

            generic_instances.extend([istio_mesh_instance, process_mixer_instance])

        return generic_instances
1181844
def instance_group(group_name)
      config = config_for_group(group_name)

      instance_group = Elasticity::InstanceGroup.new
      instance_group.role = group_name.upcase
      instance_group.type = config['instance_type']

      if config.has_key?('instance_count') && config['instance_count'] > 0
        instance_group.count = config['instance_count']
      end

      if config['use_spot_instances'] == true
        instance_group.set_spot_instances(config['bid_price'])
      end

      instance_group
    end