Return the host committee.
763862
def host(self):
        '''
        '''
        _id = None
        for participant in self['participants']:
            if participant['type'] == 'host':
                if set(['participant_type', 'id']) < set(participant):
                    # This event uses the id keyname "id".
                    if participant['participant_type'] == 'committee':
                        _id = participant['id']
                        if _id is None:
                            continue
                        return self.committees_dict.get(_id)
                else:
                    return participant['participant']
776171
def get_institution(self, **kwargs):
        """"""
        qualifier = kwargs.get('qualifier', '')
        content = kwargs.get('content', '')
        if qualifier == 'grantor':
            return content
        return None
414423
def from_hostname(cls, hostname):
        """"""
        result = cls.list({'hostname': str(hostname)})
        if result:
            return result[0]['id']
1289032
def _get_host(self, hostname):
        
        if hostname not in self.hosts:
            self.hosts[hostname] = {
                'groups': set(),
                'hostvars': {}
            }
        return self.hosts[hostname]
427397
def get_resources(cls):
        """"""
        exts = []
        parent = dict(member_name="agent",
                      collection_name="agents")
        controller = resource.Resource(HostingDeviceSchedulerController(),
                                       cb_faults.FAULT_MAP)
        exts.append(extensions.ResourceExtension(CFG_AGENT_HOSTING_DEVICES,
                                                 controller, parent))
        parent = dict(member_name=ciscohostingdevicemanager.DEVICE,
                      collection_name=ciscohostingdevicemanager.DEVICES)
        controller = resource.Resource(
            CfgAgentsHandlingHostingDeviceController(), cb_faults.FAULT_MAP)
        exts.append(extensions.ResourceExtension(HOSTING_DEVICE_CFG_AGENTS,
                                                 controller, parent,
                                                 PATH_PREFIX))
        return exts
356584
def _determine_host(data, omit=''):
    '''
    
    '''
    # This is just checking for the host with the most free ram, this needs
    # to be much more complicated.
    host = ''
    bestmem = 0
    for hv_, comps in six.iteritems(data):
        if hv_ == omit:
            continue
        if not isinstance(comps, dict):
            continue
        if comps.get('freemem', 0) > bestmem:
            bestmem = comps['freemem']
            host = hv_
    return host
788562
def getHostsFromSGE():
    """"""
    with open(os.environ["PE_HOSTFILE"], 'r') as hosts:
        return [(host.split()[0], int(host.split()[1])) for host in hosts]
459355
def splithost(url):
    """"""
    global _hostprog
    if _hostprog is None:
        import re
        _hostprog = re.compile('^//([^/?]*)(.*)$')

    match = _hostprog.match(url)
    if match:
        host_port = match.group(1)
        path = match.group(2)
        if path and not path.startswith('/'):
            path = '/' + path
        return host_port, path
    return None, url
232683
def with_host(self, host):
        
        # N.B. doesn't cleanup query/fragment
        if not isinstance(host, str):
            raise TypeError("Invalid host type")
        if not self.is_absolute():
            raise ValueError("host replacement is not allowed " "for relative URLs")
        if not host:
            raise ValueError("host removing is not allowed")
        host = self._encode_host(host)
        val = self._val
        return URL(
            self._val._replace(
                netloc=self._make_netloc(
                    val.username, val.password, host, val.port, encode=False
                )
            ),
            encoded=True,
        )
384680
def wait_for_host(self, host):
        """"""
        t = time.time()
        if host in self.times:
            due_time = self.times[host]
            if due_time > t:
                wait = due_time - t
                time.sleep(wait)
                t = time.time()
        wait_time = random.uniform(self.wait_time_min, self.wait_time_max)
        self.times[host] = t + wait_time
1114472
def hostloc(self):
        """"""
        hostloc = self.hostname
        if self.port:
            hostloc = '{hostloc}:{port}'.format(hostloc=hostloc, port=self.port)

        return hostloc
430949
def normalize_host(host):
    """"""
    if 'xn--' not in host:
        return host
    return '.'.join([_idna_decode(p) for p in host.split('.')])
421822
def get_scheduler_from_hostname(self, host_name):
        
        scheduler_uuid = self.hosts_schedulers.get(host_name, None)
        return self.schedulers.get(scheduler_uuid, None)
1334830
def members(self):
        """"""
        result = list()
        for member in self.run_command(command="replSetGetStatus", is_eval=False)['members']:
            result.append({
                "_id": member['_id'],
                "host": member["name"],
                "server_id": self._servers.host_to_server_id(member["name"]),
                "state": member['state']
            })
        return result
215472
def get_hosts_by_explosion(self, hostgroups):
        # pylint: disable=access-member-before-definition
        
        # First we tag the hg so it will not be explode
        # if a son of it already call it
        self.already_exploded = True

        # Now the recursive part
        # rec_tag is set to False every HG we explode
        # so if True here, it must be a loop in HG
        # calls... not GOOD!
        if self.rec_tag:
            logger.error("[hostgroup::%s] got a loop in hostgroup definition", self.get_name())
            return self.get_hosts()

        # Ok, not a loop, we tag it and continue
        self.rec_tag = True

        hg_mbrs = self.get_hostgroup_members()
        for hg_mbr in hg_mbrs:
            hostgroup = hostgroups.find_by_name(hg_mbr.strip())
            if hostgroup is not None:
                value = hostgroup.get_hosts_by_explosion(hostgroups)
                if value is not None:
                    self.add_members(value)

        return self.get_hosts()
493174
def getHostsFromFile(filename):
    """"""
    valid_hostname = r"^[^ /\t=\n]+"
    workers = r"\d+"
    hostname_re = re.compile(valid_hostname)
    worker_re = re.compile(workers)
    hosts = []
    with open(filename) as f:
        for line in f:
            # check to see if it is a SLURM grouping instead of a
            # regular list of hosts
            if re.search('[\[\]]', line):
                hosts = hosts + parseSLURM(line.strip())
            else:
                host = hostname_re.search(line.strip())
                if host:
                    hostname = host.group()
                    n = worker_re.search(line[host.end():])
                    if n:
                        n = n.group()
                    else:
                        # Automatically assign based on CPU count
                        n = 0
                    hosts.append((hostname, int(n)))
    return hosts
1347686
def hosts_in_group(self, groupname):
        
        result = []
        for hostname, hostinfo in self.hosts.items():
            if groupname == 'all':
                result.append(hostname)
            elif 'groups' in hostinfo:
                if groupname in hostinfo['groups']:
                    result.append(hostname)
            else:
                hostinfo['groups'] = [groupname]
        return result