def get_nodes(n=8, exclude=[], loop=None):
    '''Get Ukko nodes with the least amount of load.

    May return less than *n* nodes if there are not as many nodes available,
    the nodes are reserved or the nodes are on the exclude list.

    :param int n: Number of Ukko nodes to return.
    :param list exclude: Nodes to exclude from the returned list.
    :param loop:
        asyncio's event loop to test if each returned node is currently
        loggable. The test is done by trying to connect to the node with
        (async)ssh.

    :rtype list:
    :returns: Locations of Ukko nodes with the least amount of load
    '''
    report = _get_ukko_report()
    nodes = _parse_ukko_report(report)
    ret = []
    while len(ret) < n and len(nodes) > 0:
        node = nodes[0]
        if node not in exclude:
            reachable = True
            if loop is not None:
                reachable = loop.run_until_complete(_test_node(node))
            if reachable:
                ret.append(node)
        nodes = nodes[1:]
    return ret
def get_nodes ( n = 8 , exclude = [ ] , loop = None ) : report = _get_ukko_report ( ) nodes = _parse_ukko_report ( report ) ret = [ ] while len ( ret ) < n and len ( nodes ) > 0 : node = nodes [ 0 ] if node not in exclude : reachable = True if loop is not None : reachable = loop . run_until_complete ( _test_node ( node ) ) if reachable : ret . append ( node ) nodes = nodes [ 1 : ] return ret
Get Ukko nodes with the least amount of load.

    May return less than *n* nodes if there are not as many nodes available,
    the nodes are reserved or the nodes are on the exclude list.

    :param int n: Number of Ukko nodes to return.
    :param list exclude: Nodes to exclude from the returned list.
    :param loop:
        asyncio's event loop to test if each returned node is currently
        loggable. The test is done by trying to connect to the node with
        (async)ssh.

    :rtype list:
    :returns: Locations of Ukko nodes with the least amount of load