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

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Fri Jul 8 20:40:46 CDT 2011


Author: jonmon
Date: 2011-07-08 20:40:46 -0500 (Fri, 08 Jul 2011)
New Revision: 4812

Modified:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
Log:
o minor comment edits to the goswift command
o moved the check if the dry run option is set before files and run directory are created.


Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-08 15:39:32 UTC (rev 4811)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-09 01:40:46 UTC (rev 4812)
@@ -146,7 +146,7 @@
 
     return script
 
-# Do not know what this syntax is but pops up in other pykoa_* files.
+# Do not know what this syntax is but pops up in other pykoa_* files, so I kept it
 @cli_exception_handler
 def main( argv=sys.argv[1:] ):
     (parser, options, args) = setup_opts(argv)
@@ -166,10 +166,11 @@
     # get the swift input package
     ( tc, sites, config, script ) = parse_stdin()
 
-    # write to appropriate files created in /home/jonmon/swift/$run_directory
+    # check to see is the swift directory has been created
     if not os.access( '/home/jonmon/swift', os.F_OK ):
         os.mkdir( '/home/jonmon/swift' )
 
+    # default is run.0, if there are other directories then adjust the run directory count
     run_directory = 'run.0'
     directories = os.listdir( '/home/jonmon/swift' )
 
@@ -179,15 +180,30 @@
     directories.sort()
     directories.reverse()
 
-    # if the directories list is not empty
+    # if the directories list is not empty.
     if directories:
         last_directory = directories[ 0 ]
         ( run, sep, run_num ) = last_directory.partition( '.' )
         run_directory = run + '.' + str( int ( run_num ) + 1 )
 
+    # get a space seperated String of the sites to execute on
+    execution_sites=" ".join( map ( str, args ) )
+    sys.stdout.write( "\nExecuting Swift on: " + execution_sites + "\n" )
+    sys.stdout.write( "Execution directory: swift/" + run_directory + "\n" )
+
+    # If I do not execute the script, just print out all important information
+    # useful to verify that the inputs to the Swift command line have been parsed correctly
+    if options.do_not_execute:
+        sys.stdout.write( "\nTC file: \n" + tc + "\n" )
+        sys.stdout.write( "SITES file: \n" + sites + "\n" )
+        sys.stdout.write( "CONFIG file: \n" + config + "\n" )
+        sys.stdout.write( "SWIFTSCRIPT file: \n" + script + "\n" )
+        sys.stdout.write( "swift -sites.file sites.xml -tc.file tc -config cf script.swift\n\n" )
+        return 0
+
+    # Set up for the acutal execution
     os.mkdir( '/home/jonmon/swift/'+run_directory )
 
-    # TODO: check for IOException and return error code for IOErrors
     tc_file = open( '/home/jonmon/swift/'+run_directory+'/tc', 'w' )
     sites_file = open( '/home/jonmon/swift/'+run_directory+'/sites.xml', 'w' )
     config_file = open( '/home/jonmon/swift/'+run_directory+'/cf', 'w' )
@@ -203,21 +219,6 @@
     config_file.close()
     script_file.close()
 
-    # get a space seperated String of the sites to execute on
-    execution_sites=" ".join( map ( str, args ) )
-    sys.stdout.write( "\nExecuting Swift on: " + execution_sites + "\n" )
-    sys.stdout.write( "Execution directory: swift/" + run_directory + "\n" )
-
-    # If I do not execute the script, just print out all important information
-    # useful to verify that the inputs to the Swift command line have been parsed correctly
-    if options.do_not_execute:
-        sys.stdout.write( "\nTC file: \n" + tc + "\n" )
-        sys.stdout.write( "SITES file: \n" + sites + "\n" )
-        sys.stdout.write( "CONFIG file: \n" + config + "\n" )
-        sys.stdout.write( "SWIFTSCRIPT file: \n" + script + "\n" )
-        sys.stdout.write( "swift -sites.file sites.xml -tc.file tc -config cf script.swift\n\n" )
-        return 0
-
     # Execute the script
     os.chdir( '/home/jonmon/swift/'+run_directory )
     ( status, output ) = commands.getstatusoutput( '/home/jonmon/swift-0.92/bin/swift -sites.file sites.xml -tc.file tc -config cf script.swift' )




More information about the Swift-commit mailing list