Exemple #1
0
def main():
    """
    setres main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [cb_debug, ()]
    ]

    # Get the version information
    opt_def = __doc__.replace('__revision__', __revision__)
    opt_def = opt_def.replace('__version__', __version__)

    parser = ArgParse(opt_def, callbacks)

    whoami = client_utils.getuid()
    parser.parse_it()  # parse the command line

    validate_args(parser)

    opt = parser.options
    args = parser.args

    if opt.down:
        delta = client_utils.component_call(SYSMGR, False, 'nodes_down',
                                            (args, whoami))
        client_utils.logger.info("nodes marked down:")
        for d in delta:
            client_utils.logger.info("   %s" % d)
        client_utils.logger.info("")
        client_utils.logger.info("unknown nodes:")
        for a in args:
            if a not in delta:
                client_utils.logger.info("   %s" % a)

    elif opt.up:
        delta = client_utils.component_call(SYSMGR, False, 'nodes_up',
                                            (args, whoami))
        client_utils.logger.info("nodes marked up:")
        for d in delta:
            client_utils.logger.info("   %s" % d)
        client_utils.logger.info('')
        client_utils.logger.info("nodes that weren't in the down list:")
        for a in args:
            if a not in delta:
                client_utils.logger.info("   %s" % a)

    elif opt.list_nstates:
        header, output = client_utils.cluster_display_node_info()
        client_utils.printTabular(header + output)

    elif opt.queue:
        data = client_utils.component_call(SYSMGR, False,
                                           'set_queue_assignments',
                                           (opt.queue, args, whoami))
        client_utils.logger.info(data)
Exemple #2
0
def handle_list_io_option(sys_type):
    """
    handles list io option
    """
    if sys_type != 'bgq':
        client_utils.logger.error(
            "WARNING: IO Block information only exists on BG/Q-type systems.")

    #fetch and print bulk IO Block data
    if sys_type == 'bgq':
        args = ([{
            'name': '*',
            'size': '*',
            'status': '*',
            'state': '*',
            'block_computes_for_reboot': '*',
            'autoreboot': '*',
            'current_kernel': '*',
            'current_kernel_options': '*'
        }], )
        io_block_info = client_utils.component_call(SYSMGR, False,
                                                    'get_io_blocks', args)
        data = [[
            'Name', 'Size', 'State', 'CS Status', 'BlockComputes', 'Autoreboot'
        ]]
        for io_block in io_block_info:
            data.append([
                io_block['name'], io_block['size'], io_block['state'],
                io_block['status'],
                'x' if io_block['block_computes_for_reboot'] else '-',
                'x' if io_block['autoreboot'] else '-'
            ])
        client_utils.printTabular(data, centered=[4])
Exemple #3
0
def main():
    """
    setres main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__', __revision__)
    opt_def =  opt_def.replace('__version__', __version__)

    parser = ArgParse(opt_def, callbacks)

    whoami = client_utils.getuid()
    parser.parse_it() # parse the command line

    validate_args(parser)

    opt  = parser.options
    args = parser.args

    if opt.down:
        delta = client_utils.component_call(SYSMGR, False, 'nodes_down', (args, whoami))
        client_utils.logger.info("nodes marked down:")
        for d in delta:
            client_utils.logger.info("   %s" % d)
        client_utils.logger.info("")
        client_utils.logger.info("unknown nodes:")
        for a in args:
            if a not in delta:
                client_utils.logger.info("   %s" % a)

    elif opt.up:
        delta = client_utils.component_call(SYSMGR, False, 'nodes_up', (args, whoami))
        client_utils.logger.info("nodes marked up:")
        for d in delta:
            client_utils.logger.info("   %s" % d)
        client_utils.logger.info('')
        client_utils.logger.info("nodes that weren't in the down list:")
        for a in args:
            if a not in delta:
                client_utils.logger.info("   %s" %a)

    elif opt.list_nstates:
        header, output = client_utils.cluster_display_node_info()
        client_utils.printTabular(header + output)

    elif opt.queue:
        data = client_utils.component_call(SYSMGR, False, 'set_queue_assignments', (opt.queue, args, whoami))
        client_utils.logger.info(data)
Exemple #4
0
def main():
    """
    qmove main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__',__revision__)
    opt_def =  opt_def.replace('__version__',__version__)

    parser = ArgParse(opt_def,callbacks)

    # Set required default values: None

    parser.parse_it() # parse the command line

    if not parser.no_args():
        client_utils.logger.error("No arguments needed")
    
    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    # make sure we're on a cluster-system or orcm-system
    if ("cluster_system" != impl) and ("orcm_system" != impl):
        client_utils.logger.error("nodelist is only supported on cluster and orcm systems.  Try partlist instead.")
        sys.exit(0)

    status     = client_utils.component_call(SYSMGR, False, 'get_node_status', ())
    queue_data = client_utils.component_call(SYSMGR, False, 'get_queue_assignments', ())

    header = [['Host', 'Queue', 'State']]
    #build output list
    output = []
    for t in status:
        host_name = t[0]
        status = t[1]
        queues = []
        for q in queue_data:
            if host_name in queue_data[q]:
                queues.append(q) 
        output.append([host_name, ":".join(queues), status])
        
    client_utils.printTabular(header + output)
Exemple #5
0
def main():
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__',__revision__)
    opt_def =  opt_def.replace('__version__',__version__)

    parser = ArgParse(opt_def,callbacks)

    # Set required default values: None

    parser.parse_it() # parse the command line
    opt = parser.options
    args = parser.args

    #if not parser.no_args():
    #    client_utils.logger.error("No arguments needed")

    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    # make sure we're on a cluster-system
    if impl not in ['cluster_system', 'alps_system']:
        client_utils.logger.error("nodelist is only supported on cluster systems.  Try partlist instead.")
        sys.exit(0)

    if impl == 'alps_system':
        if opt.list_details:
            # get list from arguments.  Currently assuing a comma separated,
            # hyphen-condensed nodelist
            client_utils.print_node_details(args)
        else:
            client_utils.print_node_list()
        return



    header, output = client_utils.cluster_display_node_info()
    if parser.options.noheader is not None:
        client_utils.printTabular(header + output, with_header_info=False)
    else:
        client_utils.printTabular(header + output)
Exemple #6
0
def handle_list_io_option(sys_type):
    """
    handles list io option
    """
    if sys_type != 'bgq':
        client_utils.logger.error("WARNING: IO Block information only exists on BG/Q-type systems.")


    #fetch and print bulk IO Block data
    if sys_type == 'bgq':
        args = ([{'name':'*', 'size':'*', 'status':'*', 'state':'*', 'block_computes_for_reboot':'*', 'autoreboot':'*', 
            'current_kernel':'*', 'current_kernel_options':'*'}],)
        io_block_info = client_utils.component_call(SYSMGR, False, 'get_io_blocks', args)
        data = [['Name', 'Size', 'State', 'CS Status', 'BlockComputes', 'Autoreboot']]
        for io_block in io_block_info:
            data.append([io_block['name'], io_block['size'], io_block['state'], io_block['status'],
                'x' if io_block['block_computes_for_reboot'] else '-', 'x' if io_block['autoreboot'] else '-'])
        client_utils.printTabular(data, centered=[4])
def main():
    """
    qmove main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__',__revision__)
    opt_def =  opt_def.replace('__version__',__version__)

    parser = ArgParse(opt_def,callbacks)

    # Set required default values: None

    parser.parse_it() # parse the command line

    if not parser.no_args():
        client_utils.logger.error("No arguments needed")

    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    # make sure we're on a cluster-system
    if "cluster_system" != impl:
        client_utils.logger.error("nodelist is only supported on cluster systems.  Try partlist instead.")
        sys.exit(0)


    header, output = client_utils.cluster_display_node_info()
    if parser.options.noheader is not None:
        client_utils.printTabular(header + output, with_header_info=False)
    else:
        client_utils.printTabular(header + output)
Exemple #8
0
def main():
    """
    qmove main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [cb_debug, ()]
    ]

    # Get the version information
    opt_def = __doc__.replace("__revision__", __revision__)
    opt_def = opt_def.replace("__version__", __version__)

    parser = ArgParse(opt_def, callbacks)

    # Set required default values: None

    parser.parse_it()  # parse the command line

    if not parser.no_args():
        client_utils.logger.error("No arguments needed")

    impl = client_utils.component_call(SYSMGR, False, "get_implementation", ())

    # make sure we're on a cluster-system
    if "cluster_system" != impl:
        client_utils.logger.error("nodelist is only supported on cluster systems.  Try partlist instead.")
        sys.exit(0)

    header, output = client_utils.cluster_display_node_info()
    if parser.options.noheader is not None:
        client_utils.printTabular(header + output, with_header_info=False)
    else:
        client_utils.printTabular(header + output)
Exemple #9
0
def main():
    """
    partlist main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [cb_debug, ()]
    ]

    # Get the version information
    opt_def = __doc__.replace('__revision__', __revision__)
    opt_def = opt_def.replace('__version__', __version__)

    parser = ArgParse(opt_def, callbacks)

    parser.parse_it()  # parse the command line

    if not parser.no_args():
        client_utils.logger.error("No arguments required")
        sys.exit(1)

    sys_info = client_utils.system_info()

    sys_type = sys_info[0]

    if sys_type == 'bgq':
        spec = [{
            'tag': 'partition',
            'name': '*',
            'queue': '*',
            'state': '*',
            'size': '*',
            'functional': '*',
            'scheduled': '*',
            'children': '*',
            'backfill_time': "*",
            'draining': "*",
            'node_geometry': "*"
        }]
    else:
        spec = [{
            'tag': 'partition',
            'name': '*',
            'queue': '*',
            'state': '*',
            'size': '*',
            'functional': '*',
            'scheduled': '*',
            'children': '*',
            'backfill_time': "*",
            'draining': "*"
        }]

    parts = client_utils.component_call(SYSMGR, True, 'get_partitions',
                                        (spec, ))
    reservations = client_utils.component_call(SCHMGR, False,
                                               'get_reservations',
                                               ([{
                                                   'queue': '*',
                                                   'partitions': '*',
                                                   'active': True
                                               }], ))

    expanded_parts = {}
    for res in reservations:
        for res_part in res['partitions'].split(':'):
            for p in parts:
                if p['name'] == res_part:
                    if expanded_parts.has_key(res['queue']):
                        expanded_parts[res['queue']].update(p['children'])
                    else:
                        expanded_parts[res['queue']] = set(p['children'])
                    expanded_parts[res['queue']].add(p['name'])

    for res in reservations:
        for p in parts:
            if p['name'] in expanded_parts.get(res['queue'], []):
                p['queue'] += ":%s" % res['queue']

    def my_cmp(left, right):
        val = -cmp(int(left['size']), int(right['size']))
        if val == 0:
            return cmp(left['name'], right['name'])
        else:
            return val

    parts.sort(my_cmp)
    now = time.time()
    for part in parts:
        if part['draining'] and part['state'] == "idle":
            # remove a little extra, to make sure that users can just type the number
            # that is output by partlist to get their job to backfill
            remaining = max(0, part['backfill_time'] - now - 90)
            hours, seconds = divmod(remaining, 3600.0)
            minutes = seconds / 60.0
            part['backfill'] = "%d:%0.2d" % (int(hours), int(minutes))
        else:
            part['backfill'] = "-"

    if sys_type == 'bgq':
        header = [['Name', 'Queue', 'State', 'Backfill', 'node_geometry']]
        #build output list, adding
        output = [[part.get(x) for x in [y.lower() for y in header[0]]]
                  for part in parts
                  if part['functional'] and part['scheduled']]
        #Hack to make the display cleaner.
        header[0][4] = 'Geometry'
        for o in output:
            if o[4] != None:
                o[4] = 'x'.join([str(i) for i in o[4]])
    else:
        header = [['Name', 'Queue', 'State', 'Backfill']]
        #build output list, adding
        output = [[part.get(x) for x in [y.lower() for y in header[0]]]
                  for part in parts
                  if part['functional'] and part['scheduled']]
    client_utils.printTabular(header + output)
Exemple #10
0
def main():
    """
    setres main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__', __revision__)
    opt_def =  opt_def.replace('__version__', __version__)

    parser = ArgParse(opt_def, callbacks)

    whoami = client_utils.getuid()
    parser.parse_it() # parse the command line

    validate_args(parser)

    opt  = parser.options
    args = parser.args


    #get type of system, Cray systems handled differently

    impl = client_utils.component_call(SYSMGR, False, 'get_implementation', ())

    if impl in ['alps_system']:
        updates = {}
        if opt.list_nstates:
            client_utils.print_node_list()
            return
        if opt.list_details:
            # list details and bail
            # get list from arguments.  Currently assuing a comma separated,
            # hyphen-condensed nodelist
            client_utils.print_node_details(args)
            return
        update_type = 'ERROR'
        if opt.down:
            update_type = 'node down'
            updates['down'] = True
        elif opt.up:
            update_type = 'node up'
            updates['up'] = True
        elif opt.queue:
            update_type = 'queue'
            updates['queues'] = opt.queue
        mod_nodes = client_utils.component_call(SYSMGR, False, 'update_nodes',
                (updates, client_utils.expand_node_args(args), whoami))
        client_utils.logger.info('Update %s applied to nodes %s', update_type,
                compact_num_list(mod_nodes))

    else:
        if opt.down:
            delta = client_utils.component_call(SYSMGR, False, 'nodes_down', (args, whoami))
            client_utils.logger.info("nodes marked down:")
            for d in delta:
                client_utils.logger.info("   %s" % d)
            client_utils.logger.info("")
            client_utils.logger.info("unknown nodes:")
            for a in args:
                if a not in delta:
                    client_utils.logger.info("   %s" % a)

        elif opt.up:
            delta = client_utils.component_call(SYSMGR, False, 'nodes_up', (args, whoami))
            client_utils.logger.info("nodes marked up:")
            for d in delta:
                client_utils.logger.info("   %s" % d)
            client_utils.logger.info('')
            client_utils.logger.info("nodes that weren't in the down list:")
            for a in args:
                if a not in delta:
                    client_utils.logger.info("   %s" %a)

        elif opt.list_nstates:
            header, output = client_utils.cluster_display_node_info()
            client_utils.printTabular(header + output)

        elif opt.queue:
            data = client_utils.component_call(SYSMGR, False, 'set_queue_assignments', (opt.queue, args, whoami))
            client_utils.logger.info(data)
Exemple #11
0
def main():
    """
    partlist main
    """
    # setup logging for client. The clients should call this before doing anything else.
    client_utils.setup_logging(logging.INFO)

    # list of callback with its arguments
    callbacks = [
        # <cb function>     <cb args>
        [ cb_debug        , () ] ]

    # Get the version information
    opt_def =  __doc__.replace('__revision__',__revision__)
    opt_def =  opt_def.replace('__version__',__version__)

    parser = ArgParse(opt_def,callbacks)

    parser.parse_it() # parse the command line

    if not parser.no_args():
        client_utils.logger.error("No arguments required")
        sys.exit(1)
    
    sys_info = client_utils.system_info()
    
    sys_type = sys_info[0]

    if sys_type == 'bgq':
        spec = [{'tag':'partition', 'name':'*', 'queue':'*', 'state':'*',
                 'size':'*', 'functional':'*', 'scheduled':'*', 'children':'*',
                 'backfill_time':"*", 'draining':"*",'node_geometry':"*"}]
    else:
        spec = [{'tag':'partition', 'name':'*', 'queue':'*', 'state':'*',
                 'size':'*', 'functional':'*', 'scheduled':'*', 'children':'*',
                 'backfill_time':"*", 'draining':"*"}]

    parts        = client_utils.component_call(SYSMGR, True, 'get_partitions', (spec,))
    reservations = client_utils.component_call(SCHMGR, False, 'get_reservations', 
                                               ([{'queue':'*','partitions':'*','active':True}],))

    expanded_parts = {}
    for res in reservations:
        for res_part in res['partitions'].split(':'):
            for p in parts:
                if p['name'] == res_part:
                    if expanded_parts.has_key(res['queue']):
                        expanded_parts[res['queue']].update(p['children'])
                    else:
                        expanded_parts[res['queue']] = set( p['children'] )
                    expanded_parts[res['queue']].add(p['name'])    
    
    for res in reservations:
        for p in parts:
            if p['name'] in expanded_parts.get(res['queue'], []):
                p['queue'] += ":%s" % res['queue']

    def my_cmp(left, right):
        val = -cmp(int(left['size']), int(right['size']))
        if val == 0:
            return cmp(left['name'], right['name'])
        else:
            return val

    parts.sort(my_cmp)
    now = time.time()
    for part in parts:
        if part['draining'] and part['state'] == "idle":
            # remove a little extra, to make sure that users can just type the number
            # that is output by partlist to get their job to backfill
            remaining = max(0, part['backfill_time'] - now - 90)
            hours, seconds = divmod(remaining, 3600.0)
            minutes = seconds/60.0
            part['backfill'] = "%d:%0.2d" % (int(hours), int(minutes))
        else:
            part['backfill'] = "-"

    if sys_type == 'bgq':
        header = [['Name', 'Queue', 'State', 'Backfill', 'node_geometry']]
        #build output list, adding
        output = [[part.get(x) for x in [y.lower() for y in header[0]]] for part in parts 
                  if part['functional'] and part['scheduled']]
        #Hack to make the display cleaner.
        header[0][4] = 'Geometry'
        for o in output:
            if o[4] != None:
                o[4] = 'x'.join([str(i) for i in o[4]])
    else:
        header = [['Name', 'Queue', 'State', 'Backfill']]
        #build output list, adding
        output = [[part.get(x) for x in [y.lower() for y in header[0]]] for part in parts 
                  if part['functional'] and part['scheduled']]
    client_utils.printTabular(header + output)
Exemple #12
0
def handle_list_blocks_option(parts, sys_type):
    """
    function to handle the list io option
    """
    # need to cascade up busy and non-functional flags
    if sys_type == 'bgq':
        query = [{
            'queue': "*",
            'partitions': "*",
            'active': True,
            'block_passthrough': '*'
        }]
    elif sys_type == 'bgp':
        query = [{'queue': "*", 'partitions': "*", 'active': True}]
    try:
        reservations = client_utils.component_call(SCHMGR,
                                                   False,
                                                   'get_reservations',
                                                   (query, ),
                                                   exit_on_error=False)
    except ComponentLookupError:
        client_utils.logger.error(
            "Failed to connect to scheduler; no reservations data available")
        reservations = []

    expanded_parts = {}
    for res in reservations:
        for res_part in res['partitions'].split(":"):
            for part in parts:
                if part['name'] == res_part:
                    if expanded_parts.has_key(res['queue']):
                        if sys_type == 'bgq':
                            expanded_parts[res['queue']].update(
                                part['relatives'])
                            if res['block_passthrough']:
                                expanded_parts[res['queue']].update(
                                    part['passthrough_blocks'])
                        elif sys_type == 'bgp':
                            expanded_parts[res['queue']].update(
                                part['parents'])
                            expanded_parts[res['queue']].update(
                                part['children'])
                    else:
                        if sys_type == 'bgq':
                            expanded_parts[res['queue']] = set(
                                part['relatives'])
                            if res['block_passthrough']:
                                expanded_parts[res['queue']].update(
                                    part['passthrough_blocks'])
                        elif sys_type == 'bgp':
                            expanded_parts[res['queue']] = set(part['parents'])
                            expanded_parts[res['queue']].update(
                                part['children'])
                    expanded_parts[res['queue']].add(part['name'])

    for res in reservations:
        for part in parts:
            if part['name'] in expanded_parts[res['queue']]:
                part['queue'] += ":%s" % res['queue']

    def my_cmp(left, right):
        '''Comparator for partition sorting.  Size has priority followed by names in lexical order.

        '''
        val = -cmp(int(left['size']), int(right['size']))
        if val == 0:
            return cmp(left['name'], right['name'])
        else:
            return val

    parts.sort(my_cmp)

    offline = [part['name'] for part in parts if not part['functional']]
    if sys_type == 'bgq':
        forced = [part for part in parts \
              if [down for down in offline \
                  if down in part['relatives']]]
        for part in forced:
            part.__setitem__('functional', '-')
        data = [[
            'Name', 'Queue', 'Size', 'Geometry', 'Functional', 'Scheduled',
            'State', 'Dependencies'
        ]]
        for part in parts:
            if not part['node_geometry']:
                part['node_geometry'] = []
        data += [[
            part['name'], part['queue'], part['size'],
            "x".join([str(i) for i in part['node_geometry']]),
            part['functional'], part['scheduled'], part['state'], ','.join([])
        ] for part in parts]
        client_utils.printTabular(data, centered=[4, 5])
    elif sys_type == 'bgp':
        forced = [part for part in parts \
              if [down for down in offline \
                  if (down in part['parents'] or down in part['children']) ]]
        for part in forced:
            part.__setitem__('functional', '-')
        data = [[
            'Name', 'Queue', 'Size', 'Functional', 'Scheduled', 'State',
            'Dependencies'
        ]]
        data += [[
            part['name'], part['queue'], part['size'], part['functional'],
            part['scheduled'], part['state'], ','.join([])
        ] for part in parts]
        client_utils.printTabular(data, centered=[3, 4])
Exemple #13
0
def handle_list_blocks_option(parts, sys_type):
    """
    function to handle the list io option
    """
    # need to cascade up busy and non-functional flags
    if sys_type == 'bgq':
        query = [{'queue':"*", 'partitions':"*", 'active':True, 'block_passthrough':'*'}]
    elif sys_type == 'bgp':
        query = [{'queue':"*", 'partitions':"*", 'active':True}]
    try:
        reservations = client_utils.component_call(SCHMGR, False, 'get_reservations', (query,), exit_on_error = False)
    except ComponentLookupError:
        client_utils.logger.error("Failed to connect to scheduler; no reservations data available")
        reservations = []

    expanded_parts = {}
    for res in reservations:
        for res_part in res['partitions'].split(":"):
            for part in parts:
                if part['name'] == res_part:
                    if expanded_parts.has_key(res['queue']):
                        if sys_type == 'bgq':
                            expanded_parts[res['queue']].update(part['relatives'])
                            if res['block_passthrough']:
                                expanded_parts[res['queue']].update(part['passthrough_blocks'])
                        elif sys_type == 'bgp':
                            expanded_parts[res['queue']].update(part['parents'])
                            expanded_parts[res['queue']].update(part['children'])
                    else:
                        if sys_type == 'bgq':
                            expanded_parts[res['queue']] = set( part['relatives'] )
                            if res['block_passthrough']:
                                expanded_parts[res['queue']].update(part['passthrough_blocks'])
                        elif sys_type == 'bgp':
                            expanded_parts[res['queue']] = set( part['parents'] )
                            expanded_parts[res['queue']].update(part['children'])
                    expanded_parts[res['queue']].add(part['name'])

    for res in reservations:
        for part in parts:
            if part['name'] in expanded_parts[res['queue']]:
                part['queue'] += ":%s" % res['queue']

    def my_cmp(left, right):
        '''Comparator for partition sorting.  Size has priority followed by names in lexical order.

        '''
        val = -cmp(int(left['size']), int(right['size']))
        if val == 0:
            return cmp(left['name'], right['name'])
        else:
            return val

    parts.sort(my_cmp)

    offline = [part['name'] for part in parts if not part['functional']]
    if sys_type == 'bgq':
        forced = [part for part in parts \
              if [down for down in offline \
                  if down in part['relatives']]]
        for part in forced:
            part.__setitem__('functional', '-')
        data = [['Name', 'Queue', 'Size', 'Geometry', 'Functional', 'Scheduled', 'State', 'Dependencies']]
        for part in parts:
            if not part['node_geometry']:
                part['node_geometry'] = []
        data += [[part['name'], part['queue'], part['size'],
                  "x".join([str(i) for i in part['node_geometry']]),
                  part['functional'], part['scheduled'],
                  part['state'], ','.join([])] for part in parts]
        client_utils.printTabular(data, centered=[4, 5])
    elif sys_type == 'bgp':
        forced = [part for part in parts \
              if [down for down in offline \
                  if (down in part['parents'] or down in part['children']) ]]
        for part in forced:
            part.__setitem__('functional', '-')
        data = [['Name', 'Queue', 'Size', 'Functional', 'Scheduled', 'State', 'Dependencies']]
        data += [[part['name'], part['queue'], part['size'],
                  part['functional'], part['scheduled'],
                  part['state'], ','.join([])] for part in parts]
        client_utils.printTabular(data, centered=[3, 4])