[Swift-commit] r4931 - SwiftApps/GOSwift/pykoa/tools
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Tue Aug 2 11:28:12 CDT 2011
Author: jonmon
Date: 2011-08-02 11:28:12 -0500 (Tue, 02 Aug 2011)
New Revision: 4931
Modified:
SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
Log:
o added options that use either the trunk or stable versions of Swift for execution
o added code that dynamically finds the public ip address for the VM
- Not sure how stable this is.
Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift.py 2011-08-02 16:11:11 UTC (rev 4930)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift.py 2011-08-02 16:28:12 UTC (rev 4931)
@@ -3,6 +3,7 @@
import re
import sys
import subprocess
+import commands
import datetime
import stat
@@ -56,6 +57,14 @@
default=False, action="store_true",
help="Run Swift as an immediate command. Watch the output that Swift produces")
+ parser.add_option("--trunk", dest="trunk",
+ default=False, action="store_true",
+ help="Run the development trunk version of Swift")
+
+ parser.add_option("--stable", dest="stable",
+ default=True, action="store_true",
+ help="Run the most stable release version")
+
parser.add_option("-d", dest="deadline",
default="30m",
help="Set the time limit for this workflow. " + \
@@ -267,14 +276,31 @@
os.environ["X509_USER_KEY"] = proxyfile
os.environ["X509_USER_PROXY"] = proxyfile
- # Need to figure out how to get the values. Not sure how.
- os.environ["GLOBUS_HOSTNAME"] = "174.129.136.78"
+ # Not sure this will work all the time, but this is what the internet said i could do.
+ # Need to check for errors, maybe should use the commands module for this part so I can get the status and output at the same time
+ cmd = "curl http://169.254.169.254/2009-04-04/meta-data/public-ipv4"
+ (status, host ) = commands.getstatusoutput( cmd )
+ if status != 0:
+ sys.stderr.write( "Could not determine hostname\n" )
+ return status
+
+ # There has to be an easier way to get the last line of a string
+ # Maybe limit the curl output from above
+ lines = []
+ for line in host.split("\n"):
+ lines.append(line)
+
+ host = lines[len(lines)-1]
+ os.environ["GLOBUS_HOSTNAME"] = host
os.environ["GLOBUS_TCP_PORT_RANGE"] = "50000,51000"
os.environ["GLOBUS_SOURCE_PORT_RANGE"] = "50000,51000"
# Execute the script
-# cmd = os.path.join(os.environ["HOME"], "Swift_lib/0.92", "swift") # stable 0.92.1 release
- cmd = os.path.join(os.environ["HOME"], "Swift_lib/trunk", "swift") # trunk release
+ cmd = ""
+ if options.trunk:
+ cmd = os.path.join(os.environ["HOME"], "Swift_lib/trunk", "swift") # trunk release
+ elif options.stable:
+ cmd = os.path.join(os.environ["HOME"], "Swift_lib/0.92", "swift") # stable 0.92.1 release
os.chdir(work_directory)
status = -1
More information about the Swift-commit
mailing list