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

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Mon Jul 11 08:49:07 CDT 2011


Author: jonmon
Date: 2011-07-11 08:49:07 -0500 (Mon, 11 Jul 2011)
New Revision: 4813

Modified:
   SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
Log:
changes to use the HOME environment variable when creating the run directories.


Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-09 01:40:46 UTC (rev 4812)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift.py	2011-07-11 13:49:07 UTC (rev 4813)
@@ -167,12 +167,14 @@
     ( tc, sites, config, script ) = parse_stdin()
 
     # 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' )
+    home = os.getenv( "HOME" )
+    swift_dir = home + '/swift'
+    if not os.access( swift_dir, os.F_OK ):
+        os.mkdir( swift_dir )
 
     # 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' )
+    directories = os.listdir( swift_dir )
 
     # This might cause a performance problem(to even begin to start Swift)
     # Need to figure out how maybe purge these run directories
@@ -189,7 +191,7 @@
     # 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" )
+    sys.stdout.write( "Execution directory: "+swift_dir+"/" + 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
@@ -202,12 +204,12 @@
         return 0
 
     # Set up for the acutal execution
-    os.mkdir( '/home/jonmon/swift/'+run_directory )
+    os.mkdir( swift_dir+'/'+run_directory )
 
-    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' )
-    script_file = open( '/home/jonmon/swift/'+run_directory+'/script.swift', 'w' )
+    tc_file = open( swift_dir+'/'+run_directory+'/tc', 'w' )
+    sites_file = open( swift_dir+'/'+run_directory+'/sites.xml', 'w' )
+    config_file = open( swift_dir+'/'+run_directory+'/cf', 'w' )
+    script_file = open( swift_dir+'/'+run_directory+'/script.swift', 'w' )
 
     tc_file.write( tc )
     sites_file.write( sites )
@@ -220,16 +222,16 @@
     script_file.close()
 
     # 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' )
-    sys.stdout.write( "Swift output: " + output + "\n" )
+    os.chdir( swift_dir+'/'+run_directory )
+    ( status, output ) = commands.getstatusoutput( home+'/swift-0.92/bin/swift -sites.file sites.xml -tc.file tc -config cf script.swift' )
+    sys.stdout.write( "\nSwift output: " + output + "\n" )
     sys.stdout.write( "Swift exit status: " + str(status) + "\n" )
 
     # clean up
-    os.remove( "/home/jonmon/swift/tc" )
-    os.remove( "/home/jonmon/swift/sites.xml" )
-    os.remove( "/home/jonmon/swift/cf" )
-    os.remove( "/home/jonmon/swift/script.swift" )
+#    os.remove( swift_dir + "/" + run_directory + "/tc" )
+#    os.remove( swift_dir + "/" + run_directory + "/sites.xml" )
+#    os.remove( swift_dir + "/" + run_directory + "/cf" )
+#    os.remove( swift_dir + "/" + run_directory + "/script.swift" )
 
     return 0
 




More information about the Swift-commit mailing list