[Swift-commit] r8332 - SwiftApps/dsp-swift

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Thu Dec 11 14:31:32 CST 2014


Author: ketan
Date: 2014-12-11 14:31:32 -0600 (Thu, 11 Dec 2014)
New Revision: 8332

Modified:
   SwiftApps/dsp-swift/swiftjumpdsp.py
   SwiftApps/dsp-swift/swiftjumpdsp.xml
Log:
add field for local vs compute

Modified: SwiftApps/dsp-swift/swiftjumpdsp.py
===================================================================
--- SwiftApps/dsp-swift/swiftjumpdsp.py	2014-12-11 19:44:14 UTC (rev 8331)
+++ SwiftApps/dsp-swift/swiftjumpdsp.py	2014-12-11 20:31:32 UTC (rev 8332)
@@ -31,16 +31,6 @@
     for a in args:
         yield a
 
-def buildcfg(wdir):
-    f=open(wdir+"/cf", 'w')
-    f.write("use.provider.staging=true\n")
-    f.write("wrapperlog.always.transfer=true\n")
-    f.write("execution.retries=0\n")
-    f.write("provider.staging.pin.swiftfiles=false\n")
-    f.write("sitedir.keep=true\n")
-    f.write("lazy.errors=false\n")
-    f.close()
-
 def main():
     myargs = genargs(sys.argv)
     try:
@@ -58,134 +48,14 @@
         sys.exit(1)
 
     #which swift
-    swift = distutils.spawn.find_executable("swift")
+    swift = "/home/ketan/swift-0.95/cog/modules/swift/dist/swift-svn/bin/swift"
     
     BASEDIR = os.path.dirname(os.path.realpath(__file__))
-
-    # workout the file args
-    fileargs=[]
-    for f in myargs:
-        fileargs.append(f)
-
-    #workout the file array only if user adds args else make it blank
-    if fileargs:
-        if k_or_t == "swiftK":
-            filearrayexpr="file fileargs[] <fixed_array_mapper; files=\""+','.join(fileargs)+"\">;\n"
-        else: #T
-            filearrayexpr="file fileargs[]="+str(fileargs)+";\n"
-    else:
-        filearrayexpr="file fileargs[];\n"
     
     # create outloc dir
     if not os.path.exists(outloc):
         os.makedirs(outloc)
-        
-    # workout the stringargs
-    if stringargs:
-        stringarrayexpr="string stringargs[]="+re.sub('\'','"',str(stringargs.split()))+";\n"
-    else:
-        stringarrayexpr="string stringargs[];\n"
-    
-    wdir = setwdir().rstrip()
 
-    #workout standard input file
-    if stdin != "None":
-        if k_or_t == "swiftK":
-            stdinfilexpr = "file stdinfile<\""+stdin+"\">;\n"
-        else:
-            stdinfilexpr = "file stdinfile = input(\""+stdin+"\");\n"
-    else:
-        #print "no stdin"
-        if k_or_t == "swiftK":
-            stdinfilexpr = "file stdinfile<\"/dev/null\">;\n"
-        else:
-            stdinfilexpr = "file stdinfile = input(\"/dev/null\");\n"
-
-
-    #Build Swift source code
-    f = open(wdir+"/script.swift", "w");
-    
-    if k_or_t == "swiftK":
-        
-        f.write("type file; \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("}\n")
-        f.write(stringarrayexpr)
-        f.write(filearrayexpr)
-        f.write(stdinfilexpr)
-        f.write("file exec<\""+executable+"\">;\n")
-        
-        if range_or_list == "list":
-
-            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")
-
-        else:
-
-            f.write("foreach i in ["+rstart+":"+rend+":"+stepsize+"]{\n")
-            f.write("    file out <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", i, \".out\")>;\n")
-            f.write("    file err <single_file_mapper; file=@strcat(\""+outloc+"\", \"/\", i, \".err\")>;\n")
-        
-        f.write("    (out,err) = anapp(exec, i, stringargs, fileargs, stdinfile);\n")
-        f.write("}\n")
-
-        #build site
-        if os.path.dirname(sys.argv[0]):
-            basedir=os.path.dirname(sys.argv[0])
-        else:
-            basedir='.'
-        #print "%s %s %s" %(basedir, sites, wdir)
-        subprocess.call([basedir+"/buildsite.sh", sites, wdir])
-
-        #build config file
-        buildcfg(wdir)
-        
-        #build tc file
-        with open(wdir+"/tc", 'w') as tc:
-            for site in sites.split():
-                tc.write(site+' '+interpreter+' '+interpreter)
-
-    else: # T
-
-        f.write("import files;\n");
-        f.write("import string;\n");
-        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("}\n");
-        f.write("main{\n");
-        f.write(stringarrayexpr + " \n");
-        f.write(filearrayexpr + " \n");
-        f.write(stdinfilexpr + " \n");
-        f.write("file exec = input(\""+executable+"\");\n");
-        
-        if range_or_list == "list":
-        
-            f.write(" \n");
-            f.write("file listfile=input(\""+listfile+"\");\n")
-            f.write("string list[] = split(read(listfile),);\n");
-            f.write("foreach l, i in list{\n")
-            f.write("    file out <sprintf(\""+outloc+"/%s.%i.out\", l, i)>;\n")
-            f.write("    file err <sprintf(\""+outloc+"/%s.%i.err\", l, i)>;\n")
-        
-        else:
-        
-            f.write("foreach i in ["+rstart+":"+rend+":"+stepsize+"]{ \n");
-            f.write("    file out <sprintf(\""+outloc+"/%i.out\", i)>; \n");
-            f.write("    file err <sprintf(\""+outloc+"/%i.err\", i)>; \n");
-        
-        f.write("    (out,err) = anapp(exec, i, stringargs, fileargs, stdinfile);\n")
-        f.write("}\n");
-        f.write("printf(\"%s\", \"Done!\");\n");
-        f.write("}\n");
-    
-    f.close()  
-
     #Invocation
     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)

Modified: SwiftApps/dsp-swift/swiftjumpdsp.xml
===================================================================
--- SwiftApps/dsp-swift/swiftjumpdsp.xml	2014-12-11 19:44:14 UTC (rev 8331)
+++ SwiftApps/dsp-swift/swiftjumpdsp.xml	2014-12-11 20:31:32 UTC (rev 8332)
@@ -1,4 +1,4 @@
-<tool id="swiftjumpdsp" name="jumpdsp">
+<tool id="swiftjumpdsp" name="Run dsp from Galaxy in parallel powered by Swift">
     <!--
          ToDo:
          1. Option if the counter should be an argument, first one or last one.
@@ -32,9 +32,12 @@
         <param name="n" size="60" type="text" label="nval" help="Enter the value of n"/>
         <param name="p" size="60" type="text" label="pval" help="Enter the value of p"/>
         <param name="I" size="60" type="text" label="Ival" help="Enter the value of I"/>
+        <param name="local_or_compute" type="select" display="radio" label="choose target execution location">
+           <option value="swiftK" selected="true">local</option>
+           <option value="swiftT">compute</option>
+        </param>
     </inputs>
     <outputs>
-        <data format="txt" name="logfile" type="data" label="Application Output" />
         <data format="txt" name="outlist" type="data" label="Output List" />
     </outputs>
 
@@ -45,15 +48,11 @@
   -->
 
 <help>
-.. class:: warningmark
-
-**TIP**. Add args to provide additional arguments to your executable. 
-
------
-
 **What it does**
 
 This is a tool to run dsp via Swift in parallel over files provided by user.
 
+More description to come.
 </help>
 </tool>
+




More information about the Swift-commit mailing list