[Swift-commit] r4791 - SwiftApps/GOSwift/pykoa/tools
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Thu Jul 7 11:44:04 CDT 2011
Author: jonmon
Date: 2011-07-07 11:44:04 -0500 (Thu, 07 Jul 2011)
New Revision: 4791
Modified:
SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
Log:
o Now goswift creates unique run directories to execute in. Need to figure out how to purge these after awhile because they cannot be kept on the vm very long.
Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift.py 2011-07-07 16:38:23 UTC (rev 4790)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift.py 2011-07-07 16:44:04 UTC (rev 4791)
@@ -166,22 +166,40 @@
# 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. #
- ############################################
+ #################################################
+ # FIX: Must create a unique directory. 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 /home/jonmon/swift
if not os.access( '/home/jonmon/swift', os.F_OK ):
os.mkdir( '/home/jonmon/swift' )
- tc_file = open( '/home/jonmon/swift/tc', 'w' )
- sites_file = open( '/home/jonmon/swift/sites.xml', 'w' )
- config_file = open( '/home/jonmon/swift/cf', 'w' )
- script_file = open( '/home/jonmon/swift/script.swift', 'w' )
+ run_directory = 'run.0'
+ directories = os.listdir( '/home/jonmon/swift' )
+ # This might cause a performance problem(to even begin to start Swift)
+ # Need to figure out how maybe purge these run directories
+ # For now I can manually purge
+ directories.sort()
+ directories.reverse()
+
+ # 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 )
+
+ 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' )
+ script_file = open( '/home/jonmon/swift/'+run_directory+'/script.swift', 'w' )
+
tc_file.write( tc )
sites_file.write( sites )
config_file.write( config )
@@ -192,11 +210,13 @@
config_file.close()
script_file.close()
- # get a space seperated list of the sites to execute on
+ # 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 pertatent information
+ # 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" )
@@ -206,8 +226,8 @@
return 0
# Execute the script
- os.chdir( '/home/jonmon/swift' )
- ( status, output ) = commands.getstatusoutput( '/home/koa/swift-0.92/bin/swift -sites.file sites.xml -tc.file tc -config cf script.swift' )
+ 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" )
sys.stdout.write( "Swift exit status: " + str(status) + "\n" )
More information about the Swift-commit
mailing list