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

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Tue Jul 5 15:23:23 CDT 2011


Author: jonmon
Date: 2011-07-05 15:23:23 -0500 (Tue, 05 Jul 2011)
New Revision: 4771

Modified:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
Log:
o write the parsed information from stdin to individual to be used for execution. These files are written to /tmp
  -- These files will not have unique names. Need to make the file names unique
  -- I cannot remove them from /tmp in the python script. Need to think of an alternative place for them so /tmp will not fill up.


Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-05 18:25:03 UTC (rev 4770)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-05 20:23:23 UTC (rev 4771)
@@ -162,16 +162,40 @@
         parser.print_help()
         return 1
 
-    ( tc, sites_file, config, script ) = parse_stdin()
+    # get the swift input package
+    ( tc, sites, config, script ) = parse_stdin()
 
+    ############################################
+    # FIX: Must create a unique file. Multiple #
+    #      runs using this will clober files.  #
+    #      Multiple calls to goswift at the    #
+    #      same time will screw everything to  #
+    #      fail.                               #
+    ############################################
+    # write to appropriate files created in /tmp
+    tc_file = open( '/tmp/tc', 'w' )
+    sites_file = open( '/tmp/sites.xml', 'w' )
+    config_file = open( '/tmp/cf', 'w' )
+    script_file = open( '/tmp/script.swift', 'w' )
+
+    tc_file.write( tc )
+    sites_file.write( sites )
+    config_file.write( config )
+    script_file.write( script )
+
+    tc_file.close()
+    sites_file.close()
+    config_file.close()
+    script_file.close()
+
     # get a space seperated list of the sites to execute on
-    sites=" ".join( map ( str, args ) )
-    sys.stdout.write( "\nExecuting Swift on: " + sites + "\n" )
+    execution_sites=" ".join( map ( str, args ) )
+    sys.stdout.write( "\nExecuting Swift on: " + execution_sites + "\n" )
 
     # If I do not execute the script, just print out all pertatent information
     if options.do_not_execute:
         sys.stdout.write( "\nTC file: \n" + tc + "\n" )
-        sys.stdout.write( "SITES file: \n" + sites_file + "\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" )
@@ -179,6 +203,13 @@
 
     # Execute the script
 
+    # THIS SCRIPT DOES NOT HAVE PRIVALEDGES TO REMOVE FROM /tmp
+    # clean up
+#    os.remove( "/tmp/tc" )
+#    os.remove( "/tmp/sites.xml" )
+#    os.remove( "/tmp/config" )
+#    os.remove( "/tmp/script.swift" )
+
     return 0
 
 if __name__ == "__main__":




More information about the Swift-commit mailing list