[haizea-commit] r485 - in trunk: doc/manual src/haizea/cli

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Tue Sep 2 06:44:45 CDT 2008


Author: borja
Date: 2008-09-02 06:44:45 -0500 (Tue, 02 Sep 2008)
New Revision: 485

Modified:
   trunk/doc/manual/gen_cli_doc.py
   trunk/src/haizea/cli/commands.py
   trunk/src/haizea/cli/rpc_commands.py
Log:
CLI documentation

Modified: trunk/doc/manual/gen_cli_doc.py
===================================================================
--- trunk/doc/manual/gen_cli_doc.py	2008-09-01 11:26:33 UTC (rev 484)
+++ trunk/doc/manual/gen_cli_doc.py	2008-09-02 11:44:45 UTC (rev 485)
@@ -2,6 +2,7 @@
 import haizea.cli.rpc_commands as rpccmd
 from docutils.core import publish_string
 import re
+import textwrap
 
 commands = [cmd.haizea, rpccmd.haizea_request_lease, rpccmd.haizea_cancel_lease, rpccmd.haizea_list_leases,
             rpccmd.haizea_show_queue, rpccmd.haizea_list_hosts, cmd.haizea_generate_configs, cmd.haizea_generate_scripts, cmd.haizea_convert_data]
@@ -12,7 +13,7 @@
     c = command([])
     print "\\section{\\texttt{%s}}" % command.name
     print
-    doc = command.__doc__
+    doc = textwrap.dedent(command.__doc__).strip()
     latexdoc = publish_string(doc,  writer_name="latex")
     latexdoc = re.compile("\\\\begin{document}\n\n\\\\setlength{\\\\locallinewidth}{\\\\linewidth}\n\n(.*)\\\\end{document}", flags=re.DOTALL).search(latexdoc)
     print latexdoc.group(1)
@@ -25,7 +26,11 @@
     for opt in opts:
         if opt.action != "help":
             opt_string = c.optparser.formatter.option_strings[opt]            
-            print "\\texttt{%s} & \\sffamily %s \\\\ \\hline" % (opt_string, opt.help)
+            opt_help = textwrap.dedent(opt.help).strip()
+            latexhelp = publish_string(opt_help,  writer_name="latex")
+            latexhelp = re.compile("\\\\begin{document}\n\n\\\\setlength{\\\\locallinewidth}{\\\\linewidth}\n\n(.*)\\\\end{document}", flags=re.DOTALL).search(latexhelp)
+            latexhelp = latexhelp.group(1)
+            print "\\texttt{%s} & \\sffamily %s \\\\ \\hline" % (opt_string, latexhelp)
     print "\\end{tabular}\\end{center}"
     print
         
\ No newline at end of file

Modified: trunk/src/haizea/cli/commands.py
===================================================================
--- trunk/src/haizea/cli/commands.py	2008-09-01 11:26:33 UTC (rev 484)
+++ trunk/src/haizea/cli/commands.py	2008-09-02 11:44:45 UTC (rev 485)
@@ -31,7 +31,11 @@
 
 
 class haizea(Command):
-    """Documentation goes here"""
+    """
+    This is the main Haizea command. By default, it will start Haizea as a daemon, which
+    can receive requests via RPC or interact with other components such as OpenNebula. It can
+    also start as a foreground process, and write all log messages to the console. All
+    Haizea options are specified through the configuration file."""
     
     name = "haizea"
     
@@ -40,15 +44,17 @@
         
         self.optparser.add_option(Option("-c", "--conf", action="store", type="string", dest="conf",
                                          help = """
-                                         Option documentation goes here
+                                         The location of the Haizea configuration file. If not
+                                         specified, Haizea will first look for it in
+                                         /etc/haizea/haizea.conf and then in ~/.haizea/haizea.conf.
                                          """))
         self.optparser.add_option(Option("-f", "--fg", action="store_true",  dest="foreground",
                                          help = """
-                                         Option documentation goes here
+                                         Runs Haizea in the foreground.
                                          """))
         self.optparser.add_option(Option("--stop", action="store_true",  dest="stop",
                                          help = """
-                                         Option documentation goes here
+                                         Stops the Haizea daemon.
                                          """))
                 
     def run(self):
@@ -128,7 +134,10 @@
                    sys.exit(1)
 
 class haizea_generate_configs(Command):
-    """Documentation goes here"""
+    """
+    Takes an Haizea multiconfiguration file and generates the individual
+    configuration files. See the Haizea manual for more details on multiconfiguration
+    files."""
     
     name = "haizea-generate-configs"
 
@@ -137,11 +146,12 @@
         
         self.optparser.add_option(Option("-c", "--conf", action="store", type="string", dest="conf", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Multiconfiguration file.
                                          """))
         self.optparser.add_option(Option("-d", "--dir", action="store", type="string", dest="dir", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Directory where the individual configuration files
+                                         must be created.
                                          """))
                 
     def run(self):    
@@ -169,7 +179,10 @@
             fc.close()
 
 class haizea_generate_scripts(Command):
-    """Documentation goes here"""
+    """
+    Generates a script, based on a script template, to run all the individual 
+    configuration files generated by haizea-generate-configs. This command 
+    requires Mako Templates for Python (http://www.makotemplates.org/)."""
     
     name = "haizea-generate-scripts"
 
@@ -178,19 +191,21 @@
         
         self.optparser.add_option(Option("-c", "--conf", action="store", type="string", dest="conf", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Multiconfiguration file used in haizea-generate-configs.
                                          """))
-        self.optparser.add_option(Option("-t", "--template", action="store", type="string", dest="template", required=True,
+        self.optparser.add_option(Option("-d", "--confdir", action="store", type="string", dest="confdir", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Directory containing the individual configuration files.
                                          """))
-        self.optparser.add_option(Option("-d", "--confdir", action="store", type="string", dest="confdir", required=True,
+        self.optparser.add_option(Option("-t", "--template", action="store", type="string", dest="template", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Script template (sample templates are included in /usr/share/haizea/etc)
                                          """))
         self.optparser.add_option(Option("-m", "--only-missing", action="store_true",  dest="onlymissing",
                                          help = """
-                                         Option documentation goes here
+                                         If specified, the generated script will only run the configurations
+                                         that have not already produced a datafile. This is useful when some simulations
+                                         fail, and you don't want to have to rerun them all.
                                          """))
                 
     def run(self):        
@@ -228,8 +243,11 @@
 
 
 class haizea_convert_data(Command):
-    """Documentation goes here"""
+    """
+    Converts an Haizea datafile into another (easier to process) format.
     
+    This command is still not fully implemented."""
+    
     name = "haizea-convert-data"
 
     def __init__(self, argv):
@@ -237,24 +255,20 @@
         
         self.optparser.add_option(Option("-d", "--datafiles", action="store", type="string", dest="datafiles", required=True,
                                          help = """
-                                         Option documentation goes here
+                                         Datafiles to convert.
                                          """))
-        self.optparser.add_option(Option("-s", "--summary", action="store_true",  dest="summary",
-                                         help = """
-                                         Option documentation goes here
-                                         """))
-        self.optparser.add_option(Option("-l", "--lease-stats", action="store", type="string", dest="lease",
-                                         help = """
-                                         Option documentation goes here
-                                         """))
-        self.optparser.add_option(Option("-t", "--include-attributes", action="store_true", dest="attributes",
-                                         help = """
-                                         Option documentation goes here
-                                         """))
-        self.optparser.add_option(Option("-f", "--format", action="store", type="string", dest="format",
-                                         help = """
-                                         Option documentation goes here
-                                         """))
+        #self.optparser.add_option(Option("-s", "--summary", action="store_true",  dest="summary",
+        #                                 help = """
+        #                                 Only print out a summary, instead of data for all the leases.
+        #                                 """))
+        #self.optparser.add_option(Option("-l", "--lease-stats", action="store", type="string", dest="lease",
+        #                                 help = """
+        #                                 Option documentation goes here
+        #                                 """))
+        #self.optparser.add_option(Option("-f", "--format", action="store", type="string", dest="format",
+        #                                 help = """
+        #                                 Output format. Currently supported: csv
+        #                                 """))
                 
     def run(self):            
         self.parse_options()

Modified: trunk/src/haizea/cli/rpc_commands.py
===================================================================
--- trunk/src/haizea/cli/rpc_commands.py	2008-09-01 11:26:33 UTC (rev 484)
+++ trunk/src/haizea/cli/rpc_commands.py	2008-09-02 11:44:45 UTC (rev 485)
@@ -29,14 +29,16 @@
         Command.__init__(self, argv)
         self.optparser.add_option(Option("-s", "--server", action="store", type="string", dest="server", default=defaults.RPC_URI,
                                          help = """
-                                         Option documentation goes here
-                                         """))
+                                         Haizea RPC server URI. If not specified, the default %s is used
+                                         """ % defaults.RPC_URI))
 
     def create_rpc_proxy(self, server):
         return xmlrpclib.ServerProxy(server, allow_none=True)
 
 class haizea_request_lease(RPCCommand):
-    """Documentation goes here"""
+    """
+    Requests a new lease.
+    """
     
     name = "haizea-request-lease"
     
@@ -45,39 +47,39 @@
         
         self.optparser.add_option(Option("-t", "--start", action="store", type="string", dest="start",
                                          help = """
-                                         Option documentation goes here
+                                         Starting time. Can be an ISO timestamp, "best_effort", or "now"
                                          """))
         self.optparser.add_option(Option("-d", "--duration", action="store", type="string", dest="duration",
                                          help = """
-                                         Option documentation goes here
+                                         Duration. Can be an ISO timestamp or "unlimited"
                                          """))
         self.optparser.add_option(Option("-n", "--numnodes", action="store", type="int", dest="numnodes",
                                          help = """
-                                         Option documentation goes here
+                                         Number of nodes.
                                          """))
         self.optparser.add_option(Option("--preemptible", action="store_true", dest="preemptible",
                                          help = """
-                                         Option documentation goes here
+                                         Specifies a preemptible lease.
                                          """))
         self.optparser.add_option(Option("--non-preemptible", action="store_false", dest="preemptible",
                                          help = """
-                                         Option documentation goes here
+                                         Specifies a non-preemptible lease.
                                          """))
         self.optparser.add_option(Option("-c", "--cpu", action="store", type="float", dest="cpu",
                                          help = """
-                                         Option documentation goes here
+                                         Percentage of CPU (must be 0 < c <= 1.0)
                                          """))
         self.optparser.add_option(Option("-m", "--mem", action="store", type="int", dest="mem",
                                          help = """
-                                         Option documentation goes here
+                                         Memory per node (in MB)
                                          """))
         self.optparser.add_option(Option("-i", "--vmimage", action="store", type="string", dest="vmimage",
                                          help = """
-                                         Option documentation goes here
+                                         Disk image identifier.
                                          """))
         self.optparser.add_option(Option("-z", "--vmimagesize", action="store", type="int", dest="vmimagesize",
                                          help = """
-                                         Option documentation goes here
+                                         Disk image size.
                                          """))
         
     def run(self):
@@ -99,7 +101,9 @@
             print >> sys.stderr, "Error: %s" % msg
         
 class haizea_cancel_lease(RPCCommand):
-    """Documentation goes here"""
+    """
+    Cancel a lease.
+    """
     
     name = "haizea-cancel-lease"
     
@@ -108,7 +112,7 @@
         
         self.optparser.add_option(Option("-l", "--lease", action="store", type="int", dest="lease",
                                          help = """
-                                         Option documentation goes here
+                                         ID of lease to cancel.
                                          """))
         
     def run(self):
@@ -122,7 +126,9 @@
             print >> sys.stderr, "Error: %s" % msg
         
 class haizea_list_leases(RPCCommand):
-    """Documentation goes here"""
+    """
+    List all active leases in the system (i.e., not including completed or cancelled leases)
+    """
     
     name = "haizea-list-leases"
     
@@ -148,7 +154,9 @@
             print >> sys.stderr, "Error: %s" % msg
 
 class haizea_list_hosts(RPCCommand):
-    """Documentation goes here"""
+    """
+    List hosts managed by Haizea
+    """
     
     name = "haizea-list-hosts"
     
@@ -172,7 +180,9 @@
             print >> sys.stderr, "Error: %s" % msg
 
 class haizea_show_queue(RPCCommand):
-    """Documentation goes here"""
+    """
+    Show the contents of the Haizea queue
+    """
     
     name = "haizea-show-queue"
     
@@ -193,7 +203,10 @@
         
         try:
             leases = server.get_queue()
-            console_table_printer(fields, leases)
+            if len(leases) == 0:
+                print "Queue is empty."
+            else:
+                console_table_printer(fields, leases)
         except Exception, msg:
             print >> sys.stderr, "Error: %s" % msg
 



More information about the Haizea-commit mailing list