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)
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)
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)
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)
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)
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)