[Swift-commit] r7867 - SwiftApps/swift-galaxy/swift
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Mon May 12 16:00:07 CDT 2014
Author: ketan
Date: 2014-05-12 16:00:06 -0500 (Mon, 12 May 2014)
New Revision: 7867
Modified:
SwiftApps/swift-galaxy/swift/swiftforeach.py
SwiftApps/swift-galaxy/swift/swiftforeach.xml
Log:
clean up in code and some notes
Modified: SwiftApps/swift-galaxy/swift/swiftforeach.py
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.py 2014-05-12 19:45:46 UTC (rev 7866)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.py 2014-05-12 21:00:06 UTC (rev 7867)
@@ -37,19 +37,12 @@
try:
this=next(myargs)
range_or_list = next(myargs)
- #print "range or list=> "+ range_or_list
k_or_t = next(myargs)
- #print "k or t=> "+ k_or_t
sites = next(myargs)
- #print "sites=> " + sites
swiftargs = next(myargs)
- #print "swiftargs=> " + swiftargs
interpreter = next(myargs)
- #print "interpreter=> " + interpreter
executable = next(myargs)
- #print "executable=> " + executable
stdin = next(myargs)
- #print "stdin => " + stdin
if range_or_list == "list":
#list of items
@@ -64,7 +57,6 @@
outloc = next(myargs)
outlistfile = next(myargs)
- #print "outlistfile=>"+outlistfile
logfile = next(myargs)
stringargs = next(myargs)
except:
@@ -105,10 +97,8 @@
#workout standard input file
if stdin != "None":
if k_or_t == "swiftK":
- #print "stdinK"
stdinfilexpr = "file stdinfile<\""+stdin+"\">;\n"
else:
- #print "stdinT"
stdinfilexpr = "file stdinfile = input(\""+stdin+"\");\n"
else:
#print "no stdin"
@@ -137,8 +127,8 @@
f.write("file listfile<\""+listfile+"\">;\n")
f.write("string list[] = readData(listfile);\n");
f.write("foreach l, i in list{\n")
- f.write("file out <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", l, \".\", i, \".out\")>;\n")
- f.write("file err <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", l, \".\", i, \".err\")>;\n")
+ f.write(" file out <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", l, \".\", i, \".out\")>;\n")
+ f.write(" file err <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", l, \".\", i, \".err\")>;\n")
else:
@@ -157,15 +147,13 @@
#print "%s %s %s" %(basedir, sites, wdir)
subprocess.call([basedir+"/buildsite.sh", sites, wdir])
- #build config
+ #build config file
buildcfg(wdir)
- #build tc
- tc=open(wdir+"/tc", 'w');
- for site in sites.split():
- tc.write(site+' '+interpreter+' '+interpreter)
-
- tc.close()
+ #build tc file
+ with open(wdir+"/tc", 'w') as tc:
+ for site in sites.split():
+ tc.write(site+' '+interpreter+' '+interpreter)
else: # T
@@ -174,7 +162,7 @@
f.write("import io;\n");
f.write("\n");
f.write(" app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[], file _stdin){\n");
- f.write(" \"" +interpreter+"\" _exec _i _stringargs _fileargs @stdin=_stdin @stdout=_out @stderr=_err; \n");
+ f.write(" \"" +interpreter+"\" _exec _i _stringargs _fileargs @stdin=_stdin @stdout=_out @stderr=_err; \n");
f.write("}\n");
f.write("main{\n");
f.write(stringarrayexpr + " \n");
@@ -203,12 +191,10 @@
f.write("}\n");
f.close()
-
#Invocation
if k_or_t == "swiftK":
- #$swift -sites.file $wdir/sites.xml -tc.file $wdir/tc -config $wdir/cf $wdir/script.swift "${swiftargs}" 2>$logfile
with open(logfile,"wb") as errfile:
exitcode=subprocess.check_call([swift, "-sites.file", wdir+"/sites.xml", "-tc.file", wdir+"/tc", "-config", wdir+"/cf", wdir+"/script.swift", swiftargs],stderr=errfile)
print exitcode
@@ -216,7 +202,6 @@
else:
#print "Invoking T"
- #EXITCODE=0
stc=distutils.spawn.find_executable("stc")
java=distutils.spawn.find_executable("java")
turbine= distutils.spawn.find_executable("turbine")
@@ -246,24 +231,19 @@
elif sites == "Mira":
print "mira"
-
+ pwd=os.path.getcwd()
+ turbine_home="/home/wozniak/Public/sfw/ppc64/turbine"
+ stc="/home/wozniak/Public/sfw/ppc64/stc/bin/stc"
+ with open(logfile, "wb") as errfile:
+ exitcode=subprocess.check_call([stc, "-t", "checkpointing", "-r", pwd, "-j", java, wdir+"/script.swift"], stderr=errfile)
+
+ if exitcode == 0:
+ with open(logfile, "wb") as errfile, open("/dev/null", "r") as infile:
+ exitcode=subprocess.check_call([turbine_home+"/scripts/submit/cobalt/turbine-cobalt-run.zsh", "-n", str(n), wdir+"/script.tcl"], stdin=infile, stderr=errfile)
+
else:
- print "site not recognized"
- #"Vesta" )
- #STC=/home/wozniak/Public/sfw/stc/bin/stc
- #$STC -j $(\which java) -t checkpointing -r ${PWD} $wdir/script.swift 2>$logfile
- #$TURBINE_HOME/scripts/submit/cobalt/turbine-cobalt-run.zsh -n $n -s $HOME/cf $wdir/script.tcl
- #EXITCODE=$?
- #;;
- #"Mira" )
- #TURBINE_HOME=/home/wozniak/Public/sfw/ppc64/turbine
- #STC=/home/wozniak/Public/sfw/ppc64/stc/bin/stc
- #$STC -j $(\which java) -t checkpointing -r ${PWD} $wdir/script.swift 2>$logfile
- #$TURBINE_HOME/scripts/submit/cobalt/turbine-cobalt-run.zsh -n $n -i $HOME/prerun.sh -s $HOME/cf $wdir/script.tcl
- #EXITCODE=$?
- #;;
- #esac
+ print "Site not recognized."
#Populate output file
outlist=subprocess.check_output(["find", outloc, "-type", "f", "-iname", "*.out"])
Modified: SwiftApps/swift-galaxy/swift/swiftforeach.xml
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.xml 2014-05-12 19:45:46 UTC (rev 7866)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.xml 2014-05-12 21:00:06 UTC (rev 7867)
@@ -82,7 +82,7 @@
<option value="swiftT" >Swift/T</option>
</param>
- <param name="site" type="select" multiple="true" label="Execution Location" help="Multi-select list - hold the appropriate key while clicking to select multiple items">
+ <param name="site" type="select" multiple="true" label="Execution Location" help="Multi-select list - NOTE: Swift/T option currently supports one site">
<option value="localhost" selected="true">Localhost</option>
<option value="midway">Midway</option>
<option value="uc3">UC3</option>
@@ -130,26 +130,7 @@
</when>
</conditional>
- <!--
- <conditional name="fileorstringarg">
- <param name="fs" type="select" label="select weather to add file or string arg">
- <option value="str" selected="true">string arg</option>
- <option value="file">file arg</option>
- </param>
-
- <when value="str">
- <repeat name="strarg1" title="strarg">
- <param name="str" size="60" type="text" label="stringargs1" />
- </repeat>
- </when>
-
- <when value="file">
- <repeat name="farg1" title="farg">
- <param name="str" type="data" label="fileargs1" />
- </repeat>
- </when>
- </conditional>
- -->
+
<param name="stringargs" size="60" type="text" label="stringargs" help="Add application call commandline arguments here" />
<repeat name="filearg" title="file arg">
More information about the Swift-commit
mailing list