changeset 600:a77f7022cc06

STUB: python/multiproc.py
author Jeff Hammel <k0scist@gmail.com>
date Thu, 30 Jan 2014 13:59:09 -0800
parents 782dc37492c4
children 7f189613a289
files python/multiproc.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/python/multiproc.py	Thu Jan 30 12:45:45 2014 -0800
+++ b/python/multiproc.py	Thu Jan 30 13:59:09 2014 -0800
@@ -11,12 +11,16 @@
 import time
 import tempfile
 
-progs = {'yes': ["yes"],
-         'ping': ['ping', 'google.com']}
+class
 
 def main(args=sys.argv[1:]):
     """CLI"""
 
+    # available programs
+    progs = {'yes': ["yes"],
+             'ping': ['ping', 'google.com']}
+
+
     # parse command line
     usage = '%prog [options]'
     parser = argparse.ArgumentParser(usage=usage, description=__doc__)
@@ -25,12 +29,16 @@
                         help="seconds to run for")
     parser.add_argument("-s", "--sleep", dest="sleep",
                         type=float, default=1.,
-                        help="")
+                        help="sleep this number of seconds between polling")
+    parser.add_argument("-p", "--prog", dest='program',
+                        choices=progs.keys(),
+                        help="subprocess to run")
+    # TODO parser.add_argument("--list-programs", help="list available programs")
     options = parser.parse_args(args)
 
 
     # select program
-    prog = progs['ping']
+    prog = progs[options.program]
 
     # start the main subprocess loop
     # TODO -> OO