[Swift-commit] r4866 - SwiftApps/GOSwift/pykoa/tools

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Thu Jul 28 16:47:42 CDT 2011


Author: jonmon
Date: 2011-07-28 16:47:42 -0500 (Thu, 28 Jul 2011)
New Revision: 4866

Added:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py
Modified:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift_info.py
Log:
o removed unnecessary imports from koa_goswift_info.py
o added goswift_list command.  Lists all created run directories. This can be used to get status or info from a particular run.


Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift_info.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift_info.py	2011-07-28 18:31:33 UTC (rev 4865)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift_info.py	2011-07-28 21:47:42 UTC (rev 4866)
@@ -1,26 +1,9 @@
 #!/usr/bin/python
-import commands
-
 import os
-import re
 import sys
-import subprocess
-import datetime
 
-from sqlalchemy.sql import text
-
 import pykoa
 import pykoa.tools
-from pykoa.process_observer import ProcessObserver
-from pykoa.signal_util import BlockInterrupt, enable_sigint
-from pykoa.tools import url_parse, myproxy
-from pykoa.tools import koa_transfer
-from pykoa.tools.koa_ep_activate import check_explicit_activate
-from pykoa.consumers import guc_util
-from pykoa.constants import get_scheme
-from pykoa.data import endpoint_dao
-from pykoa.data import creds_dao
-from pykoa.koaexception import ToolsException, cli_exception_handler
 
 def setup_opts(argv):
     help_screen = """

Added: SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py	                        (rev 0)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py	2011-07-28 21:47:42 UTC (rev 4866)
@@ -0,0 +1,44 @@
+import os
+import sys
+import commands
+
+import pykoa
+import pykoa.tools
+
+def setup_opts(argv):
+    help_screen = """
+goswift_list
+
+List all run ids in the users run directory.
+
+Type 'man goswift_list' for details. \
+"""
+
+    parser = pykoa.tools.get_option_parser(help_screen)
+    
+    (options, args) = pykoa.tools.parse_args(parser, argv)
+
+    return (parser, options, args)
+
+def main( argv=sys.argv[1:] ):
+    (parser, options, args) = setup_opts(argv)
+
+    if len(args) != 0:
+        parser.print_help()
+        return 1
+
+    run_directory = os.environ["HOME"]+"/Swift";
+
+    (status, output) = commands.getstatusoutput( "/bin/ls " + run_directory )
+
+    if status != 0:
+        sys.stderr.write( "FAILED TO LIST DIRECTORY\n" )
+        pykoa.debug("Listing directory failed with error code: "+str(status) + ": /bin/ls " + run_directory)
+        return status
+
+    sys.stdout.write( output+"\n" )
+    return 0
+
+if __name__ == "__main__":
+    rc = main()
+    sys.exit(rc)




More information about the Swift-commit mailing list