Get a list of all active clients and their status
543475
def get_active_clients():
    """"""
    global drivers

    if not drivers:
        return jsonify([])

    result = {client: get_client_info(client) for client in drivers}
    return jsonify(result)
915916
def _get_vpn_status(self):
        """"""
        # Sleep for a bit to let any changes in state finish
        sleep(0.3)
        # Check if any active connections are a VPN
        bus = SystemBus()
        ids = []
        for name in self.active:
            conn = bus.get(".NetworkManager", name)
            if conn.Vpn:
                ids.append(conn.Id)
        # No active VPN
        return ids
935114
def client_status(self, config_path):
        """"""
        c = self.client_for(config_path)
        status = "stopped"
        if not c or not c.ensime:
            status = 'unloaded'
        elif c.ensime.is_ready():
            status = 'ready'
        elif c.ensime.is_running():
            status = 'startup'
        elif c.ensime.aborted():
            status = 'aborted'
        return status
399533
def active(self):
        
        return {key: value for key, value in self.conns.items()
                if value.active}
976801
def list_users(self):
        
        lines = output_lines(self.exec_psql('\\du'))
        return [line.split('|') for line in lines]
952995
def GetClientsByStatus(self):
    """"""
    started = self.GetClients()
    completed = self.GetCompletedClients()
    outstanding = started - completed

    return {
        "STARTED": started,
        "COMPLETED": completed,
        "OUTSTANDING": outstanding
    }
994800
def active(self):
        
        projects = []
        r = requests.get(self.api,
                         params={'action': 'query', 'list': 'categorymembers', 'cmpageid': self.active_id,
                                 'cmtype': 'page', 'cmlimit': '500', 'format': 'json'},
                         headers=self.header)
        if r.status_code == 200:
            jsd = r.json()
            projects.append([(x['title'], x['pageid']) for x in jsd['query']['categorymembers']])
            if 'query-continue' in jsd:
                while True:
                    r = requests.get(self.api,
                                     params={'action': 'query', 'list': 'categorymembers',
                                             'cmpageid': self.active_id, 'cmtype': 'page', 'cmlimit': '500',
                                             'cmcontinue': jsd['query-continue']['categorymembers']['cmcontinue'],
                                             'format': 'json'},
                                     headers=self.header)
                    if r.status_code == 200:
                        jsd = r.json()
                        projects.append([(x['title'], x['pageid']) for x in jsd['query']['categorymembers']])
                        if 'query-continue' not in jsd:
                            break
                    else:
                        break
        return projects[0]
1330163
def who(self, *args):
        """"""
        if len(self._users) == 0:
            self.log('No users connected')
            if len(self._clients) == 0:
                self.log('No clients connected')
                return

        Row = namedtuple("Row", ['User', 'Client', 'IP'])
        rows = []

        for user in self._users.values():
            for key, client in self._clients.items():
                if client.useruuid == user.uuid:
                    row = Row(user.account.name, key, client.ip)
                    rows.append(row)

        for key, client in self._clients.items():
            if client.useruuid is None:
                row = Row('ANON', key, client.ip)
                rows.append(row)

        self.log("\n" + std_table(rows))
131040
def list_streams(self, types=[], inactive=False):
        '''  '''
        req_hook = 'pod/v1/streams/list'
        json_query = {
                       "streamTypes": types,
                       "includeInactiveStreams": inactive
                     }
        req_args = json.dumps(json_query)
        status_code, response = self.__rest__.POST_query(req_hook, req_args)
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
550115
def list_nodes_full(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or --function.'
        )

    zone = _get_specified_zone()

    params = {
        'action': 'DescribeInstances',
        'zone': zone,
        'status': ['pending', 'running', 'stopped', 'suspended'],
    }
    items = query(params=params)

    log.debug('Total %s instances found in zone %s', items['total_count'], zone)

    result = {}

    if items['total_count'] == 0:
        return result

    for node in items['instance_set']:
        normalized_node = _show_normalized_node(node)
        node.update(normalized_node)

        result[node['instance_id']] = node

    provider = __active_provider_name__ or 'qingcloud'
    if ':' in provider:
        comps = provider.split(':')
        provider = comps[0]

    __opts__['update_cachedir'] = True
    __utils__['cloud.cache_node_list'](result, provider, __opts__)

    return result
657268
def clients(self):
        ''''''
        clients_response = self.get_request('clients/')
        return [Client(self, cjson['client']) for cjson in clients_response]
1145070
def get_active_nodes(self):
        
        # the -1 4 -1 args are the filters <proxy_id> <type> <server_id>,
        # -1 for all proxies, 4 for servers only, -1 for all servers
        stats_response = self.send_command("show stat -1 4 -1")
        if not stats_response:
            return []

        lines = stats_response.split("\n")
        fields = lines.pop(0).split(",")
        # the first field is the service name, which we key off of so
        # it's not included in individual node records
        fields.pop(0)

        active_nodes = collections.defaultdict(list)

        for line in lines:
            values = line.split(",")
            service_name = values.pop(0)
            active_nodes[service_name].append(
                dict(
                    (fields[i], values[i])
                    for i in range(len(fields))
                )
            )

        return active_nodes
1186714
async def all(
            self, whitelist: list = None, show_inactive: bool = False) -> list:
        """"""
        list_data = await self._request(
            'get', 'users/{0}/user_tiles'.format(self._user_uuid))
        tile_uuid_list = [
            tile['tile_uuid'] for tile in list_data['result']
            if not whitelist or tile['tileType'] in whitelist
        ]

        tile_data = await self._request(
            'get',
            'tiles',
            params=[('tile_uuids', uuid) for uuid in tile_uuid_list])
        return [
            tile for tile in tile_data['result'].values()
            if show_inactive or tile['visible'] is True
        ]
1220681
def users_list(self, *args):
        """"""
        if len(self._users) == 0:
            self.log('No users connected')
        else:
            self.log(self._users, pretty=True)
366994
def active_all(self, user=None):
        
        qs = self.deleted()
        if user:
            qs = qs.filter(recipient=user)
        qs.update(deleted=False)
234454
def get_task_statuses(self):
        

        params = {'taskstatus': ''}

        resp = self._client.get(self.resource(), params=params)
        self.parse(self._client, resp, obj=self)

        return dict([(task.name, task) for task in self._tasks])
1289139
private void listActiveTrackers() throws IOException {
    ClusterStatus c = jobSubmitClient.getClusterStatus(true);
    Collection<String> trackers = c.getActiveTrackerNames();
    for (String trackerName : trackers) {
      System.out.println(trackerName);
    }
  }