[Swift-commit] r8367 - SwiftApps/ematter/galaxy

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Tue Jan 20 13:41:32 CST 2015


Author: ketan
Date: 2015-01-20 13:41:32 -0600 (Tue, 20 Jan 2015)
New Revision: 8367

Added:
   SwiftApps/ematter/galaxy/genfdf.swift
   SwiftApps/ematter/galaxy/pasta.swift
   SwiftApps/ematter/galaxy/swiftgenfdf.py
   SwiftApps/ematter/galaxy/swiftpasta.py
Modified:
   SwiftApps/ematter/galaxy/genfdf.xml
   SwiftApps/ematter/galaxy/pasta.xml
Log:
adding galaxy components for ematter

Added: SwiftApps/ematter/galaxy/genfdf.swift
===================================================================
--- SwiftApps/ematter/galaxy/genfdf.swift	                        (rev 0)
+++ SwiftApps/ematter/galaxy/genfdf.swift	2015-01-20 19:41:32 UTC (rev 8367)
@@ -0,0 +1,19 @@
+type file;
+
+
+/* == App function definitions == */
+
+/* == Lammps app definition == */
+app (file _outfdf) genfdf_app (file _src, float _v, file _infdf)
+{
+   bash @_src _v @_infdf stdout=@_outfdf;
+}
+
+file src <single_file_mapper; file=arg("src")>;
+float v = toFloat(arg("v"));
+file infdf <single_file_mapper; file=arg("infdf")>;
+
+file outfdf <single_file_mapper; file=arg("outfdf")>;
+
+(outfdf) = genfdf_app (src, v, infdf);
+

Modified: SwiftApps/ematter/galaxy/genfdf.xml
===================================================================
--- SwiftApps/ematter/galaxy/genfdf.xml	2015-01-20 16:34:53 UTC (rev 8366)
+++ SwiftApps/ematter/galaxy/genfdf.xml	2015-01-20 19:41:32 UTC (rev 8367)
@@ -1,59 +1,35 @@
-<tool id="swiftjumpdsp" name="dsp swift">
+<tool id="swiftgenfdf" name="genfdf swift">
     <!--
          ToDo:
-         1. Option if the counter should be an argument, first one or last one.
-         2. Option to add files (in Galaxy dataset format) as arguments. These files then be added to Swift app as arguments.
-         3. Allow the tool to select another tool and run it.
-         4. Allow user to add more than one resource to run a job for load balancing.
-         5. Add ability to run Swift/T.
-         6. Let the localhost option be selected by default        
+         1. 
+         2. 
+         3. 
     -->
-    <description>A Galaxy tool to run Dsp parameter sweeps via Swift foreach parallel construct</description>
+    <description>A Galaxy tool to run genfdf via Swift</description>
 
     <command interpreter="python">
-        swiftjumpdsp.py
-        "${inlocation}"
-        "${a}" 
-        "${n}"
-        "${p}"
-        "${I}"
+        swiftgenfdf.py
+        "${_src}"
+        "${_r}" 
+        "${_infdf}"
         "${local_or_compute}"
-        "${resloc}"
-        "${outlist}"
-        "${outlogfile}"
+        "${outfdf}"
     </command>
     <inputs>
-        <param name="inlocation" size="60" type="text" label="inlocation" value="/home/ketan/SwiftApps/dsp-swift/dcap" help="Enter the path of the directory containing input data, eg. /home/ketan/farmer" />
-        <param name="a" size="30" type="text" label="aval" value="1" help="Enter the value of a" />
-        <param name="n" size="30" type="text" label="nval" value="1" help="Enter the value of n" />
-        <param name="p" size="30" type="text" label="pval" value="1" help="Enter the value of p" />
-        <param name="I" size="30" type="text" label="Ival" value="10" help="Enter the value of I" />
+        <param name="_src" size="30" type="data" label="genfdf source" help="Select data for genfdf source" />
+        <param name="_r" size="10" type="text" label="Value of voltage" help="Add value for voltage" />
+        <param name="_infdf" size="30" type="data" label="input fdf" help="Select data for input fdf" />
+    
         <param name="local_or_compute" type="select" display="radio" label="choose target execution location">
            <option value="local" selected="true">local</option>
            <option value="compute">compute</option>
         </param>
-        <param name="resloc" size="60" type="text" label="Location for results" value="/tmp/outdir"  help="Enter the path to a directory to put results in, eg. /tmp/outdir"/>
     </inputs>
+
     <outputs>
-        <data format="txt" name="outlist" type="data" label="Output List" />
-        <data format="txt" name="outlogfile" type="data" label="Swift Progress" />
+        <data format="txt" name="outfdf" type="data" label="Output fdf" />
     </outputs>
 <help>
-**What is this?**
-
-A tool to run dsp in parallel parameter sweeps.
-
-**What it does?**
-
-Runs dsp in parallel over a user provided input dataset and parameters.
-
-**How does it do?**
-
-The user provides input to the tool which is then delivered to the
-underlying Swift script. The script is then invoked on local/login or
-compute nodes as selected by the user. Once the tool has run, the output is
-produced in the directory location provided by the user. 
-
 More description to come.
 </help>
 </tool>

Added: SwiftApps/ematter/galaxy/pasta.swift
===================================================================
--- SwiftApps/ematter/galaxy/pasta.swift	                        (rev 0)
+++ SwiftApps/ematter/galaxy/pasta.swift	2015-01-20 19:41:32 UTC (rev 8367)
@@ -0,0 +1,16 @@
+type file;
+
+app (file _outfdf) pasta_app (file _src, file _xyz, file _infdf)
+{
+  bash @_src @_xyz @_infdf @_outfdf;
+}
+
+file src   <single_file_mapper; file=arg("src")>;
+file xyz   <single_file_mapper; file=arg("xyz")>;
+file infdf <single_file_mapper; file=arg("infdf")>;
+
+file outfdf <single_file_mapper; file=arg("outfdf")>;
+
+
+(outfdf) = pasta_app (src, xyz, infdf);
+

Modified: SwiftApps/ematter/galaxy/pasta.xml
===================================================================
--- SwiftApps/ematter/galaxy/pasta.xml	2015-01-20 16:34:53 UTC (rev 8366)
+++ SwiftApps/ematter/galaxy/pasta.xml	2015-01-20 19:41:32 UTC (rev 8367)
@@ -1,68 +1,36 @@
-<tool id="swiftjumpdsp" name="dsp swift">
+<tool id="swiftpasta" name="pasta swift">
+    
     <!--
          ToDo:
-         1. Option if the counter should be an argument, first one or last one.
-         2. Option to add files (in Galaxy dataset format) as arguments. These files then be added to Swift app as arguments.
-         3. Allow the tool to select another tool and run it.
-         4. Allow user to add more than one resource to run a job for load balancing.
-         5. Add ability to run Swift/T.
-         6. Let the localhost option be selected by default        
+         1. 
     -->
-    <description>A Galaxy tool to run Dsp parameter sweeps via Swift foreach parallel construct</description>
 
+    <description>A Galaxy tool to run the pasta tool via Swift</description>
+
     <command interpreter="python">
-        swiftjumpdsp.py
-        "${inlocation}"
-        "${a}" 
-        "${n}"
-        "${p}"
-        "${I}"
+        swiftpasta.py
+        "${_src}"
+        "${_xyz}" 
+        "${_infdf}"
+        "${_outfdf}"
         "${local_or_compute}"
-        "${resloc}"
-        "${outlist}"
-        "${outlogfile}"
     </command>
     <inputs>
-        <param name="inlocation" size="60" type="text" label="inlocation" value="/home/ketan/SwiftApps/dsp-swift/dcap" help="Enter the path of the directory containing input data, eg. /home/ketan/farmer" />
-        <param name="a" size="30" type="text" label="aval" value="1" help="Enter the value of a" />
-        <param name="n" size="30" type="text" label="nval" value="1" help="Enter the value of n" />
-        <param name="p" size="30" type="text" label="pval" value="1" help="Enter the value of p" />
-        <param name="I" size="30" type="text" label="Ival" value="10" help="Enter the value of I" />
+        <param name="_src" size="30" type="data" label="in.lammps" help="Select source for pasta" />
+        <param name="_xyz" size="30" type="data" label="geo" help="Select data for xyz" />
+        <param name="_infdf" size="30" type="data" label="eam" help="Select data for input fdf" />
         <param name="local_or_compute" type="select" display="radio" label="choose target execution location">
            <option value="local" selected="true">local</option>
            <option value="compute">compute</option>
         </param>
-        <param name="resloc" size="60" type="text" label="Location for results" value="/tmp/outdir"  help="Enter the path to a directory to put results in, eg. /tmp/outdir"/>
     </inputs>
     <outputs>
-        <data format="txt" name="outlist" type="data" label="Output List" />
-        <data format="txt" name="outlogfile" type="data" label="Swift Progress" />
+        <data format="txt" name="_outfdf" type="data" label="pasta output" />
     </outputs>
-<help>
-**What is this?**
+    
+    <help>
 
-A tool to run dsp in parallel parameter sweeps.
-
-**What it does?**
-
-Runs dsp in parallel over a user provided input dataset and parameters.
-
-**How does it do?**
-
-The user provides input to the tool which is then delivered to the
-underlying Swift script. The script is then invoked on local/login or
-compute nodes as selected by the user. Once the tool has run, the output is
-produced in the directory location provided by the user. 
-
 More description to come.
 </help>
 </tool>
 
-type file;
-
-/* == Pasta app definition == */
-app (file _fdf) pasta_app (file _pasta_src, file _xyz, file _fdf_tmp)
-{
-  bash @_pasta_src @_xyz @_fdf_tmp @_fdf;
-}
-

Added: SwiftApps/ematter/galaxy/swiftgenfdf.py
===================================================================
--- SwiftApps/ematter/galaxy/swiftgenfdf.py	                        (rev 0)
+++ SwiftApps/ematter/galaxy/swiftgenfdf.py	2015-01-20 19:41:32 UTC (rev 8367)
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+"""
+This is the Swift driver for Galaxy. It receives inputs from the Swift
+Galaxy tool and depending on the options specified, builds a
+canonical Swift/K or Swift/T script and runs over specified computational
+environment.
+
+ swiftgenfdf.py
+    "${_src}"
+    "${_r}" 
+    "${_infdf}"
+    "${local_or_compute}"
+    "${outfdf}"
+
+"""
+
+import subprocess
+import sys
+import os
+import distutils.spawn
+import traceback
+import fnmatch
+import re
+from os.path import expanduser
+
+def setwdir():
+    return subprocess.check_output(["mktemp", "-d", "/tmp/swift-gal.XXXX"])
+
+def genargs(args):
+    for a in args:
+        yield a
+
+def main():
+    myargs = genargs(sys.argv)
+    try:
+        this=next(myargs)
+        src = next(myargs)
+        v = next(myargs)
+        infdf = next(myargs)
+        local_or_compute = next(myargs)
+        outfdf = next(myargs)
+    except:
+        traceback.print_exc()
+        sys.exit(1)
+
+    homedir = expanduser("~")
+        
+    baseloc = homedir+"/SwiftApps/ematter/galaxy"
+    #which swift
+    swift = homedir+"/swift-0.95/cog/modules/swift/dist/swift-svn/bin/swift"
+    swiftargs="-src="+src+" -v="+v+" -infdf="+infdf+" -outfdf="+outfdf
+    siteval=baseloc+"/sites.local.xml"
+
+    if local_or_compute == "compute":
+        siteval=baseloc+"/sites.blues.xml"
+
+    #Invocation
+    exitcode=subprocess.check_call([swift, "-sites.file", siteval, "-tc.file", baseloc+"/apps", "-config", baseloc+"/cf", baseloc+"/genfdf.swift", swiftargs])
+    #print exitcode
+
+if __name__=='__main__':
+    main()


Property changes on: SwiftApps/ematter/galaxy/swiftgenfdf.py
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/ematter/galaxy/swiftpasta.py
===================================================================
--- SwiftApps/ematter/galaxy/swiftpasta.py	                        (rev 0)
+++ SwiftApps/ematter/galaxy/swiftpasta.py	2015-01-20 19:41:32 UTC (rev 8367)
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+"""
+This is the Swift driver for Galaxy. It receives inputs from the Swift
+Galaxy tool and depending on the options specified, builds a
+canonical Swift/K or Swift/T script and runs over specified computational
+environment.
+
+swiftpasta.py
+ "${_src}"
+ "${_xyz}" 
+ "${_infdf}"
+ "${_outfdf}"
+ "${local_or_compute}"
+
+"""
+
+import subprocess
+import sys
+import os
+import distutils.spawn
+import traceback
+import fnmatch
+import re
+from os.path import expanduser
+
+
+def genargs(args):
+    for a in args:
+        yield a
+
+def main():
+    myargs = genargs(sys.argv)
+    try:
+        this=next(myargs)
+        src = next(myargs)
+        xyz = next(myargs)
+        infdf = next(myargs)
+        outfdf = next(myargs)
+        local_or_compute = next(myargs)
+    except:
+        traceback.print_exc()
+        sys.exit(1)
+
+    homedir = expanduser("~")
+        
+    baseloc = homedir+"/SwiftApps/ematter/galaxy"
+    #which swift
+    swift = homedir+"/swift-0.95/cog/modules/swift/dist/swift-svn/bin/swift"
+    swiftargs="-src="+src+" -xyz="+xyz+" -infdf="+infdf+" -outfdf="+outfdf
+    siteval=baseloc+"/sites.local.xml"
+
+    if local_or_compute == "compute":
+        siteval=baseloc+"/sites.blues.xml"
+
+    #Invocation
+    exitcode=subprocess.check_call([swift, "-sites.file", siteval, "-tc.file", baseloc+"/apps", "-config", baseloc+"/cf", baseloc+"/pasta.swift", swiftargs])
+    #print exitcode
+
+if __name__=='__main__':
+    main()


Property changes on: SwiftApps/ematter/galaxy/swiftpasta.py
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list