[Swift-commit] r7857 - SwiftApps/swift-galaxy/swift
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Mon May 12 11:05:37 CDT 2014
Author: ketan
Date: 2014-05-12 11:05:37 -0500 (Mon, 12 May 2014)
New Revision: 7857
Modified:
SwiftApps/swift-galaxy/swift/swiftforeach.py
Log:
python version of Swift-Galaxy driver passes tests. So, will switch to python from now. This will give advantage working with existing Galaxy tools
Modified: SwiftApps/swift-galaxy/swift/swiftforeach.py
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.py 2014-05-12 16:01:47 UTC (rev 7856)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.py 2014-05-12 16:05:37 UTC (rev 7857)
@@ -6,6 +6,7 @@
import distutils.spawn
import traceback
import fnmatch
+import re
def setwdir():
return subprocess.check_output(["mktemp", "-d", "/tmp/swift-gal.XXXX"])
@@ -51,7 +52,7 @@
rstart = next(myargs)
rend = next(myargs)
stepsize = next(myargs)
- n = (rend - rstart)/stepsize
+ n = (int(rend) - int(rstart))/int(stepsize)
outloc = next(myargs)
outlistfile = next(myargs)
@@ -84,7 +85,7 @@
# workout the stringargs
if stringargs:
- stringarrayexpr="string stringargs[]="+str(stringargs.split())+";\n"
+ stringarrayexpr="string stringargs[]="+re.sub('\'','"',str(stringargs.split()))+";\n"
else:
stringarrayexpr="string stringargs[];\n"
@@ -95,10 +96,10 @@
#print "stdin"
if k_or_t == "swiftK":
#print "stdinK"
- stdinfilexpr = "file stdinfile<"+stdin+">;\n"
+ stdinfilexpr = "file stdinfile<\""+stdin+"\">;\n"
else:
#print "stdinT"
- stdinfilexpr = "file stdinfile = input("+stdin+");\n"
+ stdinfilexpr = "file stdinfile = input(\""+stdin+"\");\n"
else:
#print "no stdin"
if k_or_t == "swiftK":
@@ -169,7 +170,7 @@
f.write(stringarrayexpr + " \n");
f.write(filearrayexpr + " \n");
f.write(stdinfilexpr + " \n");
- f.write("file exec = input("+executable+");\n");
+ f.write("file exec = input(\""+executable+"\");\n");
if range_or_list == "list":
@@ -213,11 +214,11 @@
stc=distutils.spawn.find_executable("stc")
turbine= distutils.spawn.find_executable("turbine")
with open(logfile, "wb") as errfile:
- exitcode=subprocess.check_call([stc, "-j", "$(\which java)", wdir+"/script.swift"], stderr=errfile)
+ exitcode=subprocess.check_call([stc, "-j", "/homes/ketan/jdk1.7.0_07/bin/java", wdir+"/script.swift"], stderr=errfile)
if exitcode == 0:
with open(logfile, "wb") as errfile:
- exitcode=subprocess.check_call([turbine, "-n", n, wdir+"/script.swift"], stderr=errfile)
+ exitcode=subprocess.check_call([turbine, "-n", str(n), wdir+"/script.tcl"], stderr=errfile)
elif sites == "Vesta":
@@ -266,6 +267,5 @@
f.close()
-
if __name__=='__main__':
main()
More information about the Swift-commit
mailing list