def _parse_ukko_report(report):
    '''Parse Ukko's report for available (non-reserved) nodes and their current
    loads. The nodes that have load marked as '-' in report are not returned.

    :returns: List of available ukko-nodes sorted in order of their current
    load (nodes with least load are first).
    '''
    lines = report.split("\\n")
    cc = r'ukko[0-9]{3}.hpc.cs.helsinki.fi'
    nodes = []
    for line in lines:
        if re.match(cc, line) and not re.search('Reserved', line):
            # This is a line for ukko-node which is not reserved
            sline = line.split(maxsplit=10)
            try:
                load = float(sline[5])
            except:
                # Could not parse load, node might not accept SSH-connections,
                #etc. Continue to next line.
                continue
            nodes.append((sline[0], load))
    return [n[0] for n in sorted(nodes, key=operator.itemgetter(1))]
def _parse_ukko_report ( report ) : lines = report . split ( "\\n" ) cc = r'ukko[0-9]{3}.hpc.cs.helsinki.fi' nodes = [ ] for line in lines : if re . match ( cc , line ) and not re . search ( 'Reserved' , line ) : sline = line . split ( maxsplit = 10 ) try : load = float ( sline [ 5 ] ) except : continue nodes . append ( ( sline [ 0 ] , load ) ) return [ n [ 0 ] for n in sorted ( nodes , key = operator . itemgetter ( 1 ) ) ]
Parse Ukko's report for available (non-reserved) nodes and their current
    loads. The nodes that have load marked as '-' in report are not returned.

    :returns: List of available ukko-nodes sorted in order of their current
    load (nodes with least load are first).