def getMessage(self): myStr = """ Commands available in tq. Additional help for each command can be viewed with: tq help COMMAND """ # get all the defined commands from tq and add them # to the usage string. cmds = {} for cmdname,cmdobj in self.parent.parent.commands.items(): if cmdname is None: continue # get the description of the command docstr = cmdobj.description if docstr is None: docstr = "" # grab the first sentence cmds[cmdname] = docstr.strip().split('.')[0] + '.' formatStr = " %%-%ds %%s\n" % (stringutil.maxStrLen(cmds.keys())) myStr += "Renderfarm Informational Commands:\n" for cmd in ('jobs', 'tasks', 'commands', 'invocations', 'blades'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nJob Operational Commands:\n" for cmd in ('chcrews', 'chpri', 'delete', 'delay', 'jattr', 'lock', 'jobdump', 'pause', 'interrupt', 'restart', 'retryallerrs', 'skipallerrs', 'undelay', 'undelete', 'unlock', 'unpause'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nTask Operational Commands:\n" for cmd in ('retry', 'resume', 'skip', 'log'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nCommand Operational Commands:\n" for cmd in ('cattr',): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nBlade Operational Commands:\n" for cmd in ('delist', 'eject', 'nimby', 'unnimby', 'trace'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nOther Commands:\n" for cmd in ('notes', 'attributes', 'ping', 'dbreconnect', 'queuestats'): myStr += formatStr % (cmd, cmds.get(cmd)) return myStr
def getMessage(self): myStr = """ Commands available in tq. Additional help for each command can be viewed with: tq help COMMAND """ # get all the defined commands from tq and add them # to the usage string. cmds = {} for cmdname, cmdobj in self.parent.parent.commands.items(): if cmdname is None: continue # get the description of the command docstr = cmdobj.description if docstr is None: docstr = "" # grab the first sentence cmds[cmdname] = docstr.strip().split('.')[0] + '.' formatStr = " %%-%ds %%s\n" % (stringutil.maxStrLen(cmds.keys())) myStr += "Renderfarm Informational Commands:\n" for cmd in ('jobs', 'tasks', 'commands', 'invocations', 'blades'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nJob Operational Commands:\n" for cmd in ('chcrews', 'chpri', 'delete', 'delay', 'jattr', 'pause', 'interrupt', 'restart', 'retryallerrs', 'skipallerrs', 'undelay', 'undelete', 'unpause'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nTask Operational Commands:\n" for cmd in ('retry', 'resume', 'skip', 'log'): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nCommand Operational Commands:\n" for cmd in ('cattr', ): myStr += formatStr % (cmd, cmds.get(cmd)) myStr += "\nBlade Operational Commands:\n" for cmd in ('nimby', 'unnimby', 'trace'): myStr += formatStr % (cmd, cmds.get(cmd)) return myStr
def summary(self, indent=0): """Give a one line summary of each command that is defined. The summary is taken from the __doc__ string of the do_cmd function.""" myStr = '' # get all the defined commands from ListenerManager and add them # to the usage string. dofuncs = {} for func in self.__class__.__dict__.keys(): sfunc = func.split('_') if sfunc[0] == 'do': docstr = getattr(self, func).__doc__ dofuncs[sfunc[1]] = docstr.strip().split('.')[0] + '.' keys = dofuncs.keys() formatStr = "%s%%-%ds %%s\n" % (' ' * indent, stringutil.maxStrLen(keys) + 1) keys.sort() for k in keys: myStr += formatStr % (k, dofuncs[k]) return myStr